CN109257442B - File transmission method, system, terminal and storage medium based on TFTP - Google Patents

File transmission method, system, terminal and storage medium based on TFTP Download PDF

Info

Publication number
CN109257442B
CN109257442B CN201811329888.8A CN201811329888A CN109257442B CN 109257442 B CN109257442 B CN 109257442B CN 201811329888 A CN201811329888 A CN 201811329888A CN 109257442 B CN109257442 B CN 109257442B
Authority
CN
China
Prior art keywords
file
tftp
transmission
link
tftp server
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811329888.8A
Other languages
Chinese (zh)
Other versions
CN109257442A (en
Inventor
杜金燃
黄建理
陈华军
汪乐乐
黄长江
李新堂
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Taike Communication Branch Shenzhen Sdg Information Co ltd
CSG Electric Power Research Institute
Original Assignee
Taike Communication Branch Shenzhen Sdg Information Co ltd
CSG Electric Power Research Institute
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taike Communication Branch Shenzhen Sdg Information Co ltd, CSG Electric Power Research Institute filed Critical Taike Communication Branch Shenzhen Sdg Information Co ltd
Priority to CN201811329888.8A priority Critical patent/CN109257442B/en
Publication of CN109257442A publication Critical patent/CN109257442A/en
Application granted granted Critical
Publication of CN109257442B publication Critical patent/CN109257442B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/06Protocols specially adapted for file transfer, e.g. file transfer protocol [FTP]

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The invention belongs to the technical field of network file transmission, and provides a file transmission method based on TFTP, which comprises the steps of sending a link request of file transmission to a TFTP server to establish a link, sending the number digit of each newly added data block for representing a transmission file to the TFTP server for identification to obtain a read-write operation code supporting the file transmission, sending a file read-write request to the TFTP server after monitoring the read-write operation code, and carrying out file transmission with the TFTP server through the link, thereby not only realizing the technical effects of compatible default number of data block option numbers and small file transmission, but also realizing the technical effect that the TFTP server and the TFTP client can carry out negotiation transmission on a large file.

Description

File transmission method, system, terminal and storage medium based on TFTP
Technical Field
The invention belongs to the technical field of network file transmission, and particularly relates to a file transmission method, a file transmission system, a file transmission device, a file transmission terminal and a storage medium based on TFTP.
Background
TFTP (simple File Transfer Protocol) is a Protocol in the TCP/IP suite for simple File Transfer between a client and a server, which provides an uncomplicated and low-overhead File Transfer service.
At present, the transmission of simple files is mainly performed by a blocking technology, that is, the files are transmitted between the TFTP client and the TFTP server in the form of default data blocks. The specific transmission flow is as follows:
the TFTP client sends a link request of file transmission to the TFTP server;
the TFTP server side monitors the link request and then establishes link with the TFTP client side;
the TFTP client sends the option number digits of the data blocks with the default number to the TFTP server for identification;
the TFTP server identifies the option number digits of the data blocks with default number numbers of the data blocks and then sends read-write operation codes supporting file transmission to the TFTP client;
and the TFTP client sends a file read-write request to the TFTP server after monitoring the read-write operation code so as to perform file transmission with the TFTP server through linkage.
Through the specific transmission flow, the transmission of the default number of data blocks can be realized between the TFTP client and the TFTP server. The length of each data block is equal, that is, the data amount transmitted by each data block is the same.
Disclosure of Invention
However, the existing file transfer method based on TFTP can achieve the purpose of file transfer by transferring a default number of data blocks between the TFTP client and the TFTP server. However, since the number of data blocks for transmitting data in the conventional file transmission method based on TFTP is default, once a file to be transmitted is too large, the file transmission cannot be completed by the default number of data blocks, thereby causing inconvenience in file transmission.
Therefore, the conventional file transfer method based on TFTP has a technical problem that a large file with a data block capacity exceeding the default number cannot be transferred.
An aspect of the present invention is to provide a file transfer method based on TFTP, so as to solve the technical problem that the existing file transfer method based on TFTP cannot transfer large files with data block capacity exceeding the default number. The method takes a TFTP client as an execution main body to realize file transmission between the TFTP client and a TFTP server.
A file transmission method based on TFTP comprises the following steps:
sending a link request of file transmission to a TFTP server to establish a link;
sending the number digit of each newly added data block for representing the transmission file to the TFTP server for identification so as to obtain a read-write operation code supporting file transmission;
and sending a file read-write request to the TFTP server after monitoring the read-write operation code so as to perform file transmission with the TFTP server through the link.
Preferably, the method further comprises:
monitoring a tail data block of a transmission file;
judging whether the size of the data transmitted by the data block is smaller than a preset value;
if the time delay is less than the preset time delay, a time delay termination transmission instruction is sent to the TFTP service end, so that the TFTP service end closes the link after the preset time delay.
Preferably, the method further comprises:
monitoring a transmission error instruction sent by the TFTP server;
and sending a transmission termination instruction to the TFTP server according to the transmission error instruction so as to enable the TFTP server to close the link.
Preferably, the number of digits is: 2, 4, 6, 8 … … 2N(ii) a N is a positive integer.
Another aspect of the present invention is to provide a file transfer method based on TFTP, so as to solve the technical problem that the existing file transfer method based on TFTP cannot transfer large files with data block capacity exceeding the default number. The method takes a TFTP server as an execution main body to realize file transmission between a TFTP client and the TFTP server.
A file transmission method based on TFTP comprises the following steps:
monitoring a link request of file transmission sent by a TFTP client to establish a link;
monitoring and identifying the number digit of each newly added data block for representing a transmission file sent by the TFTP client so as to send a read-write operation code supporting file transmission;
and monitoring a file read-write request sent by the TFTP client so as to perform file transmission with the TFTP client through the link.
Another aspect of the present invention is to provide a file transfer system based on TFTP, so as to solve the technical problem that the existing file transfer method based on TFTP cannot transfer large files with data block capacity exceeding the default number. The system comprises a TFTP client and a TFTP server, and file transmission is carried out between the TFTP client and the TFTP server.
A TFTP-based file transfer system, comprising:
the TFTP client is used for sending a link request of file transmission to a TFTP server to establish a link, sending a newly added number bit of each data block for representing a transmission file to the TFTP server for identification so as to obtain a read-write operation code supporting the file transmission, and sending a file read-write request to the TFTP server after monitoring the read-write operation code so as to perform the file transmission with the TFTP server through the link;
and the TFTP server is used for monitoring the link request to establish a link, monitoring and identifying the newly added block option number to send the read-write operation code, and monitoring the file read-write request to perform file transmission with the TFTP client through the link.
Another aspect of the present invention is to provide a file transfer apparatus based on TFTP, so as to solve the technical problem that the existing file transfer method based on TFTP cannot transfer large files with data block capacity exceeding the default number. The device comprises a link request module, an option sending module and a monitoring request module.
A TFTP-based file transfer device, comprising:
the link request module is used for sending a link request of file transmission to the TFTP server to establish a link;
the option sending module is used for sending the number digit of each newly added data block for representing the transmission file to the TFTP server for identification so as to obtain a read-write operation code supporting file transmission;
and the monitoring request module is used for sending a file reading and writing request to the TFTP server after monitoring the reading and writing operation code so as to perform file transmission with the TFTP server through the link.
Preferably, the above apparatus further comprises:
the end monitoring module is used for monitoring an end data block of the transmission file;
the data judging module is used for judging whether the size of the data transmitted by the data block is smaller than a preset value or not;
and the delay termination module is used for sending a delay termination transmission instruction to the TFTP server when the size of the data transmitted by the data block is smaller than a preset value, so that the TFTP server closes the link after a preset delay.
It is an object of another aspect of the invention to provide a terminal comprising a memory and a processor, the memory storing a computer program that, when run in the processor, implements any of the methods described above.
It is an object of another aspect of the invention to provide a storage medium storing a computer program implementing any of the methods described above when run in a processor.
The file transmission method based on the TFTP provided by the invention comprises the steps of sending a link request of file transmission to a TFTP server to establish a link, sending the number digit of each newly added data block for representing a transmission file to the TFTP server for identification to obtain a read-write operation code supporting the file transmission, sending a file read-write request to the TFTP server after monitoring the read-write operation code to perform file transmission with the TFTP server through the link, thereby realizing the technical effects of compatible with the data block option number with the default number and transmitting a small file, and realizing the technical effect that the TFTP server and the TFTP client can perform negotiation transmission on a large file.
Drawings
FIG. 1 is a flowchart of a TFTP-based file transfer method according to an embodiment;
FIG. 2 is a flow chart of an improved method of the TFTP-based file transfer method of FIG. 1;
FIG. 3 is a flow chart of an improved method of the TFTP-based file transfer method of FIG. 2;
FIG. 4 is a flowchart of a TFTP-based file transfer method according to an embodiment;
FIG. 5 is an architecture diagram of a TFTP-based file transfer system according to an embodiment;
FIG. 6 is an architecture diagram of a file transfer device based on TFTP according to an embodiment;
fig. 7 is an architecture diagram of an improved apparatus of the TFTP-based file transfer apparatus of fig. 6.
Detailed Description
In order to make the objects, technical solutions and advantages of the present disclosure more clearly understood, the present disclosure is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
Fig. 1 is a flowchart of a file transmission method based on TFTP according to an embodiment, which illustrates a technical effect that a TFTP-based file transmission method not only achieves the technical effects of compatible default number of data block option numbers and transmission of small files, but also achieves the technical effect that a TFTP server and a TFTP client can negotiate transmission for large files.
Therefore, the conventional file transfer method based on TFTP has a technical problem that a large file with a data block capacity exceeding the default number cannot be transferred.
An aspect of the present invention is to provide a file transfer method based on TFTP, so as to solve the technical problem that the existing file transfer method based on TFTP cannot transfer large files with data block capacity exceeding the default number. The method takes a TFTP client as an execution main body to realize file transmission between the TFTP client and a TFTP server.
Referring to fig. 1, a file transfer method based on TFTP includes:
step S0, sending a link request of file transmission to the TFTP server to establish a link;
step S1, sending the number digit of each data block for representing the transmission file to the TFTP server for identification, so as to obtain the read-write operation code supporting the file transmission;
step S2, sending a file read-write request to the TFTP server after monitoring the read-write operation code, so as to perform file transmission with the TFTP server through a link.
In the embodiment, a link request for file transmission is sent to the TFTP server to establish a link, a new number bit for representing each data block of a transmission file is sent to the TFTP server for identification, so as to obtain a read-write operation code supporting the file transmission, and a file read-write request is sent to the TFTP server after monitoring the read-write operation code, so as to perform file transmission with the TFTP server through the link, thereby achieving the technical effects of not only realizing the data block option numbers compatible with the default number and transmitting small files, but also realizing the technical effect that the TFTP server and the TFTP client can perform negotiation transmission on large files.
It should be noted that, in the existing file transfer method based on TFTP, the default number of data blocks may be transferred between the TFTP client and the TFTP server, so as to achieve the purpose of file transfer. However, since the number of data blocks for transmitting data in the conventional file transmission method based on TFTP is default, once a file to be transmitted is too large, the file transmission cannot be completed by the default number of data blocks, thereby causing inconvenience in file transmission.
In contrast, in the file transmission method based on TFTP provided by this embodiment, because the TFTP server and the TFTP client may negotiate for transmitting the file, the number of bits of the option number of the newly added block can be automatically sent and the number of bits of the option number of the newly added block can be automatically identified, and thus, transmission of a large file can be achieved.
Preferably, the number of digits is: 2,4,6,8 ……2N. Wherein N is a positive integer of 2NRefers to the power N of 2.
For example, when a file is transferred by the conventional file transfer method based on TFTP, since the default number of a data block for transferring data is 2 bytes, which means a 2-byte number, it is up to 0xffff, that is, 65535. Meanwhile, since the amount of data transferred per block of data is equal, usually, the maximum amount is 32768 bytes, and therefore, the file size transferred by the data block with the 2-byte number is 65535 × 32768 bytes at the maximum.
When a file is transmitted by the file transmission method based on TFTP provided in this embodiment, assuming that the value of N is 2 at this time, the number of bits of the option number of the newly added block is 22=4 bytes, so the number of new added block option number bits of the 4-byte data block indicates that the number of the data blocks is 0 xfffffffff block, i.e. 4294967295. Meanwhile, since the amount of data transferred per block of data is equal, usually, the maximum amount is 32768 bytes, and therefore, the size of a file transferred by using a 4-byte numbered data block is 4294967295 × 32768 bytes at the maximum. Since N is a positive integer and may be any integer greater than 2, in theory, the file may be transmitted by the file transmission method based on TFTP provided in this embodiment to an infinitely large file.
It should be noted that: x indicates hexadecimal. f indicates the maximum number of digits in hexadecimal.
In addition, in this embodiment, since the data amount of the file that can be transmitted by the default number of data blocks is much smaller than the data amount of the file that can be transmitted by the data blocks represented by the added block option number, the file that is transmitted by the default number of data blocks is referred to as a small file, and the file that is transmitted by the data blocks represented by the added block option number is referred to as a large file.
It should be further noted that, in step S0, the TFTP client sends a link request for file transfer to the TFTP server, and the TFTP server monitors the link request and then establishes a link to prepare for file transfer.
It should be further noted that, in step S1, the TFTP client sends the number bits of each data block newly added for representing the transmission file to the TFTP server for identification, and after the TFTP server monitors and identifies the option number of the newly added block, the TFTP server sends the read-write operation code supporting the file transmission to the TFTP client, thereby implementing the negotiation for transmitting the large file between the TFTP client and the TFTP server.
It should be noted that, in step S2, the TFTP client monitors the read/write operation code and sends a file read/write request to the TFTP server. The TFTP server monitors the file read-write request and performs file transmission with the TFTP client through a link.
Fig. 2 is a flowchart of an embodiment of an improved method of the TFTP-based file transfer method in fig. 1, which illustrates an improved method of the TFTP-based file transfer method, and the improved method achieves a technical effect of avoiding waste of network transmission resources.
Referring to fig. 2, the file transfer method based on TFTP further includes:
step 100, monitoring a tail data block of a transmission file;
step 101, judging whether the size of data transmitted by a data block is smaller than a preset value;
and 102, when the size of the data transmitted by the data block is smaller than a preset value, sending a delay termination transmission instruction to the TFTP server, so that the TFTP server closes the link after the preset delay.
In this embodiment, the time for ending the file transmission can be obtained by judging the size of the data transmitted by the last data block of the transmission file, so that the link is closed timely, and the waste of network transmission resources is avoided.
In addition, when the TFTP client performs file transfer with the TFTP server, the TFTP client generally follows the receiving feedback rule. Next, the present embodiment will describe how to perform receiving feedback between the TFTP client and the TFTP server by taking the TFTP client transmitting a file to the TFTP server as an example.
The TFTP client sends the data block to the TFTP server and waits for the feedback response of the TFTP server, if the feedback response is not waited for all the time, the TFTP client repeatedly sends the data block, but if the TFTP server sends the feedback response to the TFTP client and the TFTP client does not continuously send the next data block, the TFTP server repeatedly sends the feedback response. Such repeated transmission will result in a waste of network transmission resources.
In this embodiment, the TFTP server is controlled to disconnect the link according to the preset delay time by the delayed termination transmission instruction, so that the link is closed timely, and the technical effect of avoiding network transmission resource waste is achieved.
Fig. 3 is a flowchart of an embodiment of an improved method of the TFTP-based file transfer method in fig. 2, which illustrates an improved method of the TFTP-based file transfer method, and the improved method achieves a technical effect of avoiding waste of network transmission resources.
Referring to fig. 3, the TFTP-based file transfer method further includes:
s200, monitoring a transmission error instruction sent by a TFTP server;
s201, according to the transmission error command, sending a transmission termination command to the TFTP service end, so that the TFTP service end closes the link.
In this embodiment, the TFTP server closes the link by monitoring the transmission error command sent by the TFTP server and sending the transmission termination command to the TFTP server according to the transmission error command, thereby achieving the technical effect of avoiding the waste of network transmission resources.
Fig. 4 is a flowchart of a file transfer method based on TFTP according to an embodiment, which illustrates a file transfer method based on TFTP, where the method uses a TFTP server as an execution subject to implement file transfer between a TFTP client and the TFTP server.
Referring to fig. 4, a file transfer method based on TFTP includes:
step 300, monitoring a link request of file transmission sent by a TFTP client to establish a link;
step 301, monitoring and identifying the number digit of each newly added data block used for representing a transmission file sent by a TFTP client to send a read-write operation code supporting file transmission;
step 302, monitoring a file read-write request sent by the TFTP client to perform file transmission with the TFTP client through a link.
In this embodiment, a link is established by monitoring a link request of file transmission sent by a TFTP client, a read-write operation code supporting file transmission is sent by monitoring and identifying the number digit of each newly added data block used for representing a transmission file sent by the TFTP client, and a file read-write request sent by the TFTP client is monitored to perform file transmission with the TFTP client through the link, so that not only is the technical effects of compatible default number of serial numbers of data block options and transmission of small files achieved, but also the technical effect that a TFTP server and the TFTP client can perform negotiation transmission for large files is achieved.
It should be noted that, in the existing file transfer method based on TFTP, the default number of data blocks may be transferred between the TFTP client and the TFTP server, so as to achieve the purpose of file transfer. However, since the number of data blocks for transmitting data in the conventional file transmission method based on TFTP is default, once a file to be transmitted is too large, the file transmission cannot be completed by the default number of data blocks, thereby causing inconvenience in file transmission.
In contrast, in the file transmission method based on TFTP provided by this embodiment, because the TFTP server and the TFTP client may negotiate for transmitting the file, the number of bits of the option number of the newly added block can be automatically sent and the number of bits of the option number of the newly added block can be automatically identified, and thus, transmission of a large file can be achieved.
Preferably, the number of digits is: 2, 4, 6, 8 … … 2N. Wherein N is a positive integer of 2NRefers to the power N of 2.
For example, when a file is transferred by the conventional file transfer method based on TFTP, since the default number of a data block for transferring data is 2 bytes, which means a 2-byte number, it is up to 0xffff, that is, 65535. Meanwhile, since the amount of data transferred per block of data is equal, usually, the maximum amount is 32768 bytes, and therefore, the file size transferred by the data block with the 2-byte number is 65535 × 32768 bytes at the maximum.
When a file is transmitted by the file transmission method based on TFTP provided in this embodiment, assuming that the value of N is 2 at this time, the number of bits of the block option number is newly addedIs 22=4 bytes, so the number of new added block option number bits of the 4-byte data block indicates that the number of the data blocks is 0 xfffffffff block, i.e. 4294967295. Meanwhile, since the amount of data transferred per block of data is equal, usually, the maximum amount is 32768 bytes, and therefore, the size of a file transferred by using a 4-byte numbered data block is 4294967295 × 32768 bytes at the maximum. Since N is a positive integer and may be any integer greater than 2, in theory, the file may be transmitted by the file transmission method based on TFTP provided in this embodiment to an infinitely large file.
It should be noted that: it should be noted that: x indicates hexadecimal. f indicates the maximum number of digits in hexadecimal.
In addition, in this embodiment, since the data amount of the file that can be transmitted by the default number of data blocks is much smaller than the data amount of the file that can be transmitted by the data blocks represented by the added block option number, the file that is transmitted by the default number of data blocks is referred to as a small file, and the file that is transmitted by the data blocks represented by the added block option number is referred to as a large file.
It should be further noted that, in step 300, the TFTP client sends a link request for file transfer to the TFTP server, and the TFTP server establishes a link after monitoring the link request, so as to prepare for file transfer.
It should be further noted that, in step 301, the TFTP client sends the number bits of each newly added data block for representing the transmission file to the TFTP server for identification, and after the TFTP server monitors and identifies the option number of the newly added block, the TFTP server sends the read-write operation code supporting the file transmission to the TFTP client, thereby implementing the negotiation for transmitting the large file between the TFTP client and the TFTP server.
It should be further noted that, in step 302, the TFTP client monitors the read-write operation code and sends a file read-write request to the TFTP server. The TFTP server monitors the file read-write request and performs file transmission with the TFTP client through a link.
Fig. 5 is an architecture diagram of a file transfer system based on TFTP according to an embodiment, which illustrates a file transfer system based on TFTP, and the system implements file transfer between a TFTP client and a TFTP server to solve a technical problem that a large file with a data block capacity exceeding a default number cannot be transferred by using an existing file transfer method based on TFTP.
Referring to fig. 5, a TFTP-based file transfer system includes:
the TFTP client 1 is used for sending a link request of file transmission to a TFTP server to establish a link, sending a number bit number of each newly added data block for representing a transmission file to the TFTP server for identification so as to obtain a read-write operation code supporting the file transmission, and sending a file read-write request to the TFTP server after monitoring the read-write operation code so as to perform the file transmission with the TFTP server through the link;
and the TFTP server 2 is used for monitoring the link request to establish a link, monitoring and identifying the option number of the newly added block to send a read-write operation code, and monitoring the file read-write request to perform file transmission with the TFTP client 1 through the link.
Fig. 6 is an architecture diagram of a file transfer device based on TFTP according to an embodiment, which illustrates a file transfer device based on TFTP, and the device can solve the technical problem that the existing file transfer method based on TFTP cannot transfer large files with a data block capacity exceeding the default number.
Referring to fig. 6, a TFTP-based file transfer apparatus includes:
a link request module 10, configured to send a link request for file transmission to the TFTP server 2 to establish a link;
the option sending module 11 is configured to send the number bits of each newly added data block used for representing the transmission file to the TFTP server 2 for identification, so as to obtain a read-write operation code supporting file transmission;
and the monitoring request module 12 is configured to send a file reading and writing request to the TFTP server 2 after monitoring the reading and writing operation code, so as to perform file transmission with the TFTP server 2 through a link.
In this embodiment, a link request for file transmission is sent to the TFTP server 2 through the link request module 10 to establish a link, a new number bit for representing each data block of a transmission file is sent to the TFTP server 2 through the option sending module 11 to be identified to obtain a read-write operation code for supporting file transmission, a read-write operation code is monitored by the monitoring request module 12 and then a file read-write request is sent to the TFTP server 2, so as to perform file transmission with the TFTP server 2 through the link, thereby achieving the technical effects of not only realizing the option numbers of the data blocks compatible with default numbers and transmitting small files, but also realizing the technical effect that the TFTP server 2 and the TFTP client 1 can perform negotiation transmission on large files.
It should be noted that, in the existing file transfer method based on TFTP, the default number of data blocks may be transferred between the TFTP client 1 and the TFTP server 2, so as to achieve the purpose of file transfer. However, since the number of data blocks for transmitting data in the conventional file transmission method based on TFTP is default, once a file to be transmitted is too large, the file transmission cannot be completed by the default number of data blocks, thereby causing inconvenience in file transmission.
In contrast, in the file transmission method based on TFTP provided in this embodiment, because the TFTP server 2 and the TFTP client 1 may negotiate to transmit the file, the number of bits of the option number of the newly added block can be automatically sent and the number of bits of the option number of the newly added block can be automatically identified, and thus, transmission of a large file can be achieved.
Preferably, the number of digits is: 2, 4, 6, 8 … … 2N. Wherein N is a positive integer of 2NRefers to the power N of 2.
For example, when a file is transferred by the conventional file transfer method based on TFTP, since the default number of a data block for transferring data is 2 bytes, which means a 2-byte number, it is up to 0xffff, that is, 65535. Meanwhile, since the amount of data transferred per block of data is equal, usually, the maximum amount is 32768 bytes, and therefore, the file size transferred by the data block with the 2-byte number is 65535 × 32768 bytes at the maximum.
When a file is transmitted by the file transmission method based on TFTP provided in this embodiment, assuming that the value of N is 2 at this time, the number of bits of the option number of the newly added block is 22=4 bytes, so a new addition of 4-byte data blocksThe number of bits of the block option number indicates that the number of data blocks is 0 xfffffffff blocks, i.e., 4294967295. Meanwhile, since the amount of data transferred per block of data is equal, usually, the maximum amount is 32768 bytes, and therefore, the size of a file transferred by using a 4-byte numbered data block is 4294967295 × 32768 bytes at the maximum. Since N is a positive integer and may be any integer greater than 2, in theory, the file may be transmitted by the file transmission method based on TFTP provided in this embodiment to an infinitely large file.
It should be noted that: x indicates hexadecimal. f indicates the maximum number of digits in hexadecimal.
In addition, in this embodiment, since the data amount of the file that can be transmitted by the default number of data blocks is much smaller than the data amount of the file that can be transmitted by the data blocks represented by the added block option number, the file that is transmitted by the default number of data blocks is referred to as a small file, and the file that is transmitted by the data blocks represented by the added block option number is referred to as a large file.
It should be further noted that the link request module 10 sends a link request for file transmission to the TFTP server 2, and the TFTP server 2 establishes a link after monitoring the link request to prepare for file transmission.
It should be further noted that the option sending module 11 sends the number bits of each newly added data block for representing the transmission file to the TFTP server 2 for identification, and after the TFTP server 2 monitors and identifies the option number of the newly added block, sends the read-write operation code supporting file transmission to the TFTP client 1, thereby implementing negotiation for transmitting a large file between the TFTP client 1 and the TFTP server 2.
It should be further noted that, the monitoring request module 12 sends a file read-write request to the TFTP server 2 after monitoring the read-write operation code. The TFTP server 2 monitors the file read-write request and performs file transmission with the TFTP client 1 through a link.
Fig. 7 is an architecture diagram of an improved apparatus of the file transfer apparatus based on TFTP in fig. 6 according to an embodiment, which illustrates an improved apparatus of the file transfer apparatus based on TFTP, and the improved apparatus can achieve the technical effect of avoiding waste of network transmission resources.
Referring to fig. 7, a TFTP-based file transfer apparatus includes:
a last segment monitoring module 13, configured to monitor a last segment data block of a transmission file;
the data judging module 14 is configured to judge whether the size of data transmitted by the data block is smaller than a preset value;
and a delay termination module 15, configured to send a delay termination transmission instruction to the TFTP server 2 when the size of the data transmitted by the data block is smaller than a preset value, so that the TFTP server 2 closes the link after a preset delay.
Further, it is an object of another aspect of the invention to provide a terminal comprising a memory and a processor, the memory storing a computer program, the computer program implementing any of the methods described above when run in the processor.
It is an object of another aspect of the invention to provide a storage medium storing a computer program implementing any of the methods described above when the computer program is run on a processor.
The file transmission method based on the TFTP provided by the invention comprises the steps of sending a link request of file transmission to a TFTP server to establish a link, sending the number digit of each newly added data block for representing a transmission file to the TFTP server for identification to obtain a read-write operation code supporting the file transmission, sending a file read-write request to the TFTP server after monitoring the read-write operation code to perform file transmission with the TFTP server through the link, thereby realizing the technical effects of compatible with the data block option number with the default number and transmitting a small file, and realizing the technical effect that the TFTP server and the TFTP client can perform negotiation transmission on a large file.
The above description is only for the purpose of illustrating the preferred embodiments of the present invention and is not to be construed as limiting the invention, and any modifications, equivalents and improvements made within the spirit and principle of the present invention are intended to be included within the scope of the present invention.

Claims (10)

1. A file transmission method based on TFTP is characterized by comprising the following steps:
sending a link request of file transmission to a TFTP server to establish a link;
sending the number digit of each newly added data block for representing the transmission file to the TFTP server for identification so as to obtain a read-write operation code supporting file transmission;
and sending a file read-write request to the TFTP server after monitoring the read-write operation code so as to perform file transmission with the TFTP server through the link.
2. The method of claim 1, further comprising:
monitoring a tail data block of a transmission file;
judging whether the size of the data transmitted by the data block is smaller than a preset value;
if the time delay is less than the preset time delay, a time delay termination transmission instruction is sent to the TFTP service end, so that the TFTP service end closes the link after the preset time delay.
3. The method of claim 2, further comprising:
monitoring a transmission error instruction sent by the TFTP server;
and sending a transmission termination instruction to the TFTP server according to the transmission error instruction so as to enable the TFTP server to close the link.
4. A method according to any one of claims 1 to 3, wherein the number of bits is: 2, 4, 6, 8 … … 2N(ii) a N is a positive integer.
5. A file transmission method based on TFTP is characterized by comprising the following steps:
monitoring a link request of file transmission sent by a TFTP client to establish a link;
monitoring and identifying the number digit of each newly added data block for representing a transmission file sent by the TFTP client so as to send a read-write operation code supporting file transmission;
and monitoring a file read-write request sent by the TFTP client so as to perform file transmission with the TFTP client through the link.
6. A TFTP-based file transfer system, comprising:
the TFTP client is used for sending a link request of file transmission to a TFTP server to establish a link, sending a newly added number bit of each data block for representing a transmission file to the TFTP server for identification so as to obtain a read-write operation code supporting the file transmission, and sending a file read-write request to the TFTP server after monitoring the read-write operation code so as to perform the file transmission with the TFTP server through the link;
and the TFTP server is used for monitoring the link request to establish a link, monitoring and identifying the number digit of each newly added data block for representing a transmission file to send the read-write operation code, and monitoring the file read-write request to perform file transmission with the TFTP client through the link.
7. A TFTP-based file transfer device, comprising:
the link request module is used for sending a link request of file transmission to the TFTP server to establish a link;
the option sending module is used for sending the number digit of each newly added data block for representing the transmission file to the TFTP server for identification so as to obtain a read-write operation code supporting file transmission;
and the monitoring request module is used for sending a file reading and writing request to the TFTP server after monitoring the reading and writing operation code so as to perform file transmission with the TFTP server through the link.
8. The apparatus of claim 7, further comprising:
the end monitoring module is used for monitoring an end data block of the transmission file;
the data judging module is used for judging whether the size of the data transmitted by the data block is smaller than a preset value or not;
and the delay termination module is used for sending a delay termination transmission instruction to the TFTP server when the size of the data transmitted by the data block is smaller than a preset value, so that the TFTP server closes the link after a preset delay.
9. A terminal comprising a memory and a processor, the memory storing a computer program, characterized in that the computer program realizes the method of any of claims 1-5 when run in the processor.
10. A storage medium storing a computer program, characterized in that the computer program realizes the method of any of claims 1-5 when run in a processor.
CN201811329888.8A 2018-11-09 2018-11-09 File transmission method, system, terminal and storage medium based on TFTP Active CN109257442B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811329888.8A CN109257442B (en) 2018-11-09 2018-11-09 File transmission method, system, terminal and storage medium based on TFTP

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811329888.8A CN109257442B (en) 2018-11-09 2018-11-09 File transmission method, system, terminal and storage medium based on TFTP

Publications (2)

Publication Number Publication Date
CN109257442A CN109257442A (en) 2019-01-22
CN109257442B true CN109257442B (en) 2021-10-22

Family

ID=65042924

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811329888.8A Active CN109257442B (en) 2018-11-09 2018-11-09 File transmission method, system, terminal and storage medium based on TFTP

Country Status (1)

Country Link
CN (1) CN109257442B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114448970A (en) * 2021-12-27 2022-05-06 天翼云科技有限公司 Data transmission method, device and equipment

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1655550A (en) * 2004-02-10 2005-08-17 三星电子株式会社 System and method for trivial file transfer protocol including broadcasting function
CN103888464A (en) * 2014-03-28 2014-06-25 上海斐讯数据通信技术有限公司 File transmission method based on TFTP

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100415111B1 (en) * 2002-02-19 2004-01-13 삼성전자주식회사 Initialization method of the internet protocol phone in an internet protocol telephony system
US20080279098A1 (en) * 2004-04-02 2008-11-13 Heonchul Park Wireless Receiver Code Download and Boot Sequence
CN101409727B (en) * 2008-11-24 2012-12-12 株洲南车时代电气股份有限公司 Document transmission method and apparatus
US8769137B2 (en) * 2011-06-23 2014-07-01 Honeywell International Inc. Systems and methods for negotiated accelerated block option for trivial file transfer protocol (TFTP)
CN103618678A (en) * 2013-11-18 2014-03-05 北京星网锐捷网络技术有限公司 Method, device and system for self-adaptation multiple-link aggregation

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1655550A (en) * 2004-02-10 2005-08-17 三星电子株式会社 System and method for trivial file transfer protocol including broadcasting function
CN103888464A (en) * 2014-03-28 2014-06-25 上海斐讯数据通信技术有限公司 File transmission method based on TFTP

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于TFTP协议的简单文件传输系统的研究;郭秋丽;《电子技术研发》;20130731;第3.1节-第4.1.2节,图5-6 *
基于TFTP协议的远程升级设计;lcchunguo;《https://www.cnblogs.com/lcchuguo/p/5097760.html》;20160104;第2.4.1-2.4.2节 *

Also Published As

Publication number Publication date
CN109257442A (en) 2019-01-22

Similar Documents

Publication Publication Date Title
US20200314181A1 (en) Communication with accelerator via RDMA-based network adapter
US9258349B2 (en) Method and apparatus of performing remote computer file exchange
US10484472B2 (en) Methods and systems for efficiently moving data between nodes in a cluster
US7200641B1 (en) Method and system for encoding SCSI requests for transmission using TCP/IP
JP6312842B2 (en) System, method, and program for supporting data communication in heterogeneous environment
WO2022127118A1 (en) File transmission method and apparatus, and electronic device and storage medium
CN110062054B (en) Remote control method and system for Internet of things equipment
CN110808948B (en) Remote procedure calling method, device and system
US10177975B2 (en) Method and apparatus of performing remote management of a managed machine
CN110417632B (en) Network communication method, system and server
CN109257442B (en) File transmission method, system, terminal and storage medium based on TFTP
CN112968919B (en) Data processing method, device, equipment and storage medium
JP2009182459A (en) Communication device, communication system, communication method, and program
US6401123B1 (en) Systems, methods and computer program products for employing presumptive negotiation in a data communications protocol
CN102647465A (en) File transfer protocol (FTP) data transmission method and device applied in stack system
CN102065143A (en) Communication method and system based on HTTP (hyper Text Transfer Protocol), HTTP server and HTTP client
CN109361746A (en) A kind of document transmission method of Internet of Things, work board and readable storage medium storing program for executing
CN105141696A (en) File uploading method and device
CN111726401A (en) File transmission method and device
CN101778117B (en) Network storing and processing method, device and wireless terminal
CN112422485A (en) Communication method and device of transmission control protocol
CN105471718A (en) Realization method of full duplex message queue
EP3955524A1 (en) Method for managing remote storage device by means of management device
JP2000276424A (en) Transmission data conversion device and computer readable storage medium with program stored
US9736008B1 (en) Communication rate adjustment extension

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant