File transmission method, FTP proxy device, storage medium and product

By sending heartbeat data between the FTP proxy device and the file receiving device to maintain a connection, the problem of unstable file transfer and low success rate in the FTP protocol due to connection timeout is solved, and higher file transfer stability and success rate are achieved.

CN119743476APending Publication Date: 2025-04-01HUBEI TIANRONGXIN NETWORK SECURITY TECH CO LTD +3
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411862678.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-17
Publication Date
2025-04-01

AI Technical Summary

Technical Problem

The existing FTP protocol is prone to interruption due to connection timeout during file transfer, resulting in unstable file transfer and low success rate.

Method used

When the FTP proxy device establishes a data connection with the file receiving device, the timing is started and the heartbeat data is sent to the file receiving device when the connection timeout time arrives, and the timing is re-timed to keep the data connection stable.

Benefits of technology

By periodically sending heartbeat data, the stability of file transfer is improved, file transfer failures caused by connection interruption are reduced, file transfer success rate is improved, and resource usage is optimized.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119743476A_ABST
    Figure CN119743476A_ABST
Patent Text Reader

Abstract

The invention relates to a file transmission method, FTP proxy equipment, a computer readable storage medium and a computer program product, and belongs to the technical field of Internet. The method is applied to FTP proxy equipment and comprises the following steps: starting timing under the condition that data connection is established between the FTP proxy equipment and file receiving equipment; in the file transmission process, obtaining the connection timeout time of the file receiving equipment; when the timing duration reaches the connection timeout time, heartbeat data are sent to the file receiving equipment, and timing is carried out again; wherein the heartbeat data is used for enabling the file receiving equipment to keep data connection with the FTP proxy equipment. In the file transmission process, the heartbeat data is sent to the file receiving device, the data connection between the file receiving device and the FTP proxy device is maintained, the situation that file transmission fails due to connection interruption is reduced, the stability of file transmission is improved, and therefore the success rate of file transmission is increased.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application belongs to the field of Internet technology, and specifically relates to a file transmission method, an FTP proxy device, a computer-readable storage medium, and a computer program product. Background Art

[0002] FTP (File Transfer Protocol) is a communication protocol for transferring files on the Internet. The FTP protocol is usually used to transfer files between a client and a server. When transferring files, most FTP clients and FTP servers have a connection timeout mechanism. If the FTP client or FTP server does not receive the file data within the specified time, the connection between them will be disconnected and the file transfer will be terminated, which will lead to unstable file transfer and a low success rate of file transfer. Summary of the invention

[0003] In view of this, the purpose of this application is to provide a file transfer method, an FTP proxy device, a computer-readable storage medium and a computer program product to improve the current problems of unstable file transfer and low file transfer success rate.

[0004] The embodiment of the present application is implemented as follows:

[0005] In a first aspect, an embodiment of the present application provides a file transfer method, which is applied to an FTP proxy device, and the method includes: starting timing when the FTP proxy device establishes a data connection with a file receiving device; during the file transfer process, obtaining a connection timeout period of the file receiving device; whenever the timing reaches the connection timeout period, sending heartbeat data to the file receiving device and re-timing; wherein the heartbeat data is used to enable the file receiving device to maintain a data connection with the FTP proxy device.

[0006] In the above embodiment, during the file transfer process, by periodically sending heartbeat data to the file receiving device, the FTP proxy device and the file receiving device can be kept connected, thereby improving the stability of file transfer, reducing file transfer failures due to connection interruption, and thus improving the success rate of file transfer; at the same time, the connection timeout time of the file receiving device is used as the cycle time for sending heartbeat data, so that when the connection is about to time out, the heartbeat data can be sent in time, the number of reconnections caused by timeout can be reduced, the efficiency of file transfer can be improved, and unnecessary connection reconstruction can be reduced, thereby optimizing resource utilization; and starting the timing from the time when the FTP proxy device and the file receiving device establish a data connection can more accurately perform timeout detection and reduce misjudgments caused by factors such as network fluctuations or temporary delays.

[0007] In combination with a possible implementation manner of the first aspect embodiment, the file transfer includes file downloading, and the method further includes: determining whether the size of the target file to be transmitted is greater than a preset maximum detection file size; if so, transparently transmitting the target file to the file receiving device.

[0008] In the above embodiment, when a file is downloaded and the size of the target file to be transmitted is larger than the preset maximum detection file size, transparently transmitting the target file to the file receiving device can significantly improve the efficiency of file transmission; and transparently transmitting the target file can also automatically adjust the transmission speed and strategy to adapt to complex network environments, thereby ensuring the stability of file transmission.

[0009] In combination with a possible implementation manner of the embodiment of the first aspect, the FTP proxy device establishes a control connection with the file receiving device and the file sending device respectively, and the method further includes: obtaining and parsing an FTP command sent by an FTP client, wherein the FTP client is a file receiving device when downloading a file, and is a file sending device when uploading a file; when the FTP command is a download command, obtaining the target file size from the file sending device, and after obtaining the target file size, forwarding the FTP command to the file sending device; or, generating a command for obtaining the target file size, and forwarding the command for obtaining the target file size and the FTP command to the file sending device; after the file sending device responds to the FTP command, the FTP proxy device establishes a data connection with the file receiving device and the file sending device respectively.

[0010] In the above embodiment, before the FTP proxy device establishes data connections with the file receiving device and the file sending device respectively, the size of the target file is first obtained; the advantage of this is that the FTP proxy device can select different transmission methods according to the size of the target file, thereby improving the transmission efficiency; and in a multi-user environment, the FTP proxy server can reasonably allocate transmission tasks according to the size of the target file and the current network load to achieve load balancing, thereby improving the overall transmission efficiency; in addition, the FTP proxy server can also implement security policies based on the target file size information to reduce the spread of malware or the abuse of network resources and improve the security of file transmission.

[0011] In combination with a possible implementation manner of the embodiment of the first aspect, the heartbeat data is the first data of the target file to be transmitted, and the method further includes: recording the number of bytes of the heartbeat data sent each time, wherein the heartbeat data sent each time is data at a different position in the first data; when transmitting the target file to the file receiving device, the data in the target file is offset by the number of bytes and then transmitted to the file receiving device.

[0012] In the above embodiment, the first data of the target file to be transmitted is sent to the file receiving device as heartbeat data, which can reduce the possibility of the file receiving device generating dirty data to damage the file, and realize the heartbeat function while sending the file data, thereby reducing the loss of resources and improving the transmission efficiency; at the same time, the data in the target file is offset by the number of bytes that have been sent before being transmitted to the file receiving device, thereby ensuring the integrity of the file.

[0013] In combination with a possible implementation manner of the embodiment of the first aspect, obtaining the connection timeout period of the file receiving device includes: obtaining a target identity identifier of the file receiving device; matching the target identity identifier with a preset correspondence between an identity identifier and a connection timeout period; if the match is successful, obtaining the corresponding connection timeout period based on the correspondence between the matched identity identifier and the connection timeout period; or, if the match is unsuccessful, using a preset duration as the connection timeout period.

[0014] In the above embodiment, when the target identity of the file receiving device successfully matches the corresponding relationship between the preset identity and the connection timeout time, the connection timeout time corresponding to the identity is used as the cycle time of the heartbeat data, so that the cycle time of the heartbeat data can be more in line with the needs of the file receiving device, thereby reducing network congestion and improving file transfer efficiency; and the connection status between the FTP device and the file receiving device can be accurately managed to reduce interruptions and delays in the file transfer process; when the target identity of the file receiving device fails to match the corresponding relationship between the preset identity and the connection timeout time, the preset duration is used as the connection timeout time, which helps to simplify the complexity of management.

[0015] In combination with a possible implementation manner of the embodiment of the first aspect, the correspondence between the preset identity identifier and the connection timeout period is stored in a database, and the method also includes: obtaining a first duration from the establishment of the data connection between the FTP proxy device and the file receiving device to the disconnection due to a timeout exception, and obtaining a target identity identifier of the file receiving device; matching the target identity identifier with the identity identifier stored in the database; if the match is successful, updating the connection timeout period corresponding to the target identity identifier in the database to the first duration; or, if the match is unsuccessful, using the first duration as the connection timeout period, and establishing a correspondence between the target identity identifier and the first duration in the database.

[0016] In the above embodiment, the identity identifier and connection timeout time in the database are dynamically updated according to the target identity identifier of the file receiving device and the actual connection timeout time between the FTP proxy device and the file receiving device, so that the connection timeout time in the database can be applied to different needs and scenarios, which can reduce the problem of inaccurate timeout judgment caused by replacing the file receiving device or manually modifying the timeout time of the file receiving device, improve the adaptability of the connection timeout time, and thus improve the stability of file transmission.

[0017] In combination with a possible implementation manner of the embodiment of the first aspect, the FTP proxy device includes a timeout callback function, and sending heartbeat data to the file receiving device includes: triggering the timeout callback function and sending heartbeat data to the file receiving device.

[0018] In the above embodiment, by triggering the timeout callback function and sending heartbeat data to the file receiving device, it is possible to adapt to different network environments and application scenarios and improve the adaptability of the file transmission method.

[0019] In a second aspect, an embodiment of the present application provides an FTP proxy device, comprising: a memory and a processor, the processor being connected to the memory; the memory being used to store programs; the processor being used to call the programs stored in the memory to execute the method provided in the above-mentioned first aspect embodiment and / or in combination with any possible implementation method of the first aspect embodiment.

[0020] In a third aspect, an embodiment of the present application provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the method provided by the above-mentioned embodiment of the first aspect and / or any possible implementation method in combination with the embodiment of the first aspect is executed.

[0021] In a fourth aspect, an embodiment of the present application provides a computer program product, which includes a computer program. When the computer program is executed by a processor, it executes the method provided by the above-mentioned first aspect embodiment and / or any possible implementation method combined with the first aspect embodiment.

[0022] Other features and advantages of the present application will be described in the following description. The purpose and other advantages of the present application can be realized and obtained through the structures specifically pointed out in the written description and the drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can also be obtained based on these drawings. The above and other purposes, features and advantages of the present application will be more clearly shown in the drawings.

[0024] Figure 1 A structural schematic diagram of a file transmission system provided in an embodiment of the present application is shown.

[0025] Figure 2 A flowchart of a file transmission method provided in an embodiment of the present application is shown.

[0026] Figure 3 A schematic flow chart of a database updating method provided in an embodiment of the present application is shown.

[0027] Figure 4 A flowchart of another file transmission method provided in an embodiment of the present application is shown.

[0028] Figure 5 A schematic diagram showing the principles of a file transmission method provided in an embodiment of the present application is shown.

[0029] Figure 6 A schematic structural diagram of a file transmission device provided in an embodiment of the present application is shown.

[0030] Figure 7 A structural diagram of an FTP proxy device provided in an embodiment of the present application is shown. DETAILED DESCRIPTION

[0031] The technical scheme in the embodiment of the present application will be described below in conjunction with the accompanying drawings in the embodiment of the present application. Obviously, the described embodiment is only a part of the embodiment of the present application, rather than all the embodiments. The following embodiments can be used as examples to more clearly illustrate the technical scheme of the present application, and cannot be used to limit the protection scope of the present application. It can be understood by those skilled in the art that the features in the following embodiments and embodiments can be combined with each other without conflict.

[0032] It should be noted that similar numbers and letters represent similar items in the following figures, so once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures. At the same time, in the description of this application, relational terms such as "first", "second", etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device.

[0033] Furthermore, the term "and / or" in this application is merely a term used to describe the association relationship between associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone.

[0034] In the description of the embodiments of the present application, unless otherwise clearly specified or limited, the technical term "connection" may refer to a direct connection or an indirect connection through an intermediate medium.

[0035] An embodiment of the present application provides a file transfer method, which periodically sends heartbeat data to a file receiving device during the file transfer process, so that the file receiving device maintains a data connection with an FTP proxy device, reduces the possibility of connection interruption due to file transfer timeout, and further reduces the possibility of file transfer failure, thereby improving the stability of file transfer and thus improving the success rate of file transfer.

[0036] The file transmission method provided in the embodiment of the present application involves a file transmission system such as Figure 1 The file transfer system can be a data leakage prevention system, a security isolation and information exchange system, a cross-network file transfer system, etc.

[0037] like Figure 1As shown, the file transfer system may include a file sending device, a file receiving device and an FTP proxy device, and the FTP proxy device is connected to the file sending device and the file receiving device respectively. The file sending device and the file receiving device implement file transfer through the FTP proxy device. When performing file transfer, the FTP proxy device establishes two connections with the file sending device and the file receiving device respectively: a "control connection" and a "data connection". The control connection and the data connection are independent of each other. The control connection remains open throughout the entire file transfer process and is responsible for coordinating the establishment and closing of the data connection, that is, responsible for the transmission of commands and response commands, such as for sending login information, file transfer commands, etc. The data connection is responsible for specific file data transmission.

[0038] The above-mentioned file sending device and file receiving device can both be FTP clients or FTP servers. Specifically, when the file transmission is file uploading, the file sending device can be an FTP client and the file receiving device can be an FTP server. When the file transmission is file downloading, the file sending device can be an FTP server and the file receiving device can be an FTP client.

[0039] The file transfer method provided in the embodiment of the present application can be applied to the FTP proxy device in the above-mentioned file transfer system. Figure 2 The flowchart shown illustrates the file transmission method. The file transmission method comprises the following steps:

[0040] Step S100: When the FTP proxy device establishes a data connection with the file receiving device, start timing.

[0041] When the FTP proxy device establishes a data connection with the file receiving device, the FTP proxy device also establishes a data connection with the file sending device.

[0042] In the above step S100, timing can be performed by a timer of the FTP proxy device, or by a real-time clock, a scheduled task scheduler, a hardware timer, etc. of the FTP proxy device.

[0043] Step S200: During the file transmission process, the connection timeout period of the file receiving device is obtained.

[0044] In one implementation, the file transfer process in the above step S200 may include a file caching process. In this implementation, the FTP proxy device may cache the target file sent by the file sending device while sending the cached target file to the file receiving device; or after caching the target file sent by the file sending device, the target file is sent to the file receiving device. In this case, the FTP proxy device may cache the target file for too long, causing the file receiving device to disconnect from the FTP proxy device due to not receiving the file data for a long time.

[0045] In one implementation, the FTP proxy device can decide whether to cache the target file based on the type of file transfer (upload or download). In some implementations, when the file transfer type is upload, the target file is cached. In some implementations, when the file transfer type is download, the file transfer method provided by the embodiment of the present application also includes: determining whether the size of the target file to be transferred is greater than the preset maximum detection file size; if yes, transparently transmitting the target file to the file receiving device; if no, caching the target file.

[0046] The maximum file size is the maximum file size that the FTP proxy device can detect. Transparent transmission of target files means that the FTP device does not parse or process the target file, but only transfers the target file from the file sending device to the file receiving device. Transparent transmission does not change the content or format of the target file, and keeps the target file intact.

[0047] When a file is being downloaded and the size of the target file to be transmitted is larger than the preset maximum detection file size, the target file is transparently transmitted to the file receiving device without being processed. It is directly transmitted with low latency and fast transmission speed, which can significantly improve the efficiency of file transmission.

[0048] In this implementation manner, the file transfer method provided in the embodiment of the present application also includes: after the FTP proxy device respectively establishes a control connection with the file receiving device and the file sending device, the FTP proxy device obtains and parses the FTP command sent by the FTP client, wherein the FTP client is the file receiving device or the file sending device; when the FTP command is a download command, the FTP proxy device generates a command for obtaining the target file size and sends it to the file sending device, obtains the target file size from the file sending device, and after obtaining the target file size, forwards the FTP command to the file sending device; or, when the FTP command is a download command, generates a command for obtaining the target file size, and forwards the command for obtaining the target file size and the FTP command together to the file sending device; after the file sending device responds to the FTP command, the FTP proxy device respectively establishes data connections with the file receiving device and the file sending device.

[0049] Among them, the FTP command may include information such as file operation instructions, file transfer settings, file permissions and ownership, etc. Therefore, by parsing the FTP command, it can be known whether the current FTP command is a file upload command or a file download command.

[0050] In one implementation, the file transfer process in step S200 may include a file caching process and a file security detection process. In this implementation, the FTP proxy device may cache and detect the target file for too long, causing the file receiving device to disconnect from the FTP proxy device due to not receiving the file data for a long time.

[0051] Among them, the file security detection process refers to the FTP proxy device evaluating the security of the target file sent by the file sending device, checking whether the target file complies with laws and regulations, corporate policies and security standards, so as to ensure the legality and security of file transfer. File security detection includes but is not limited to sensitive content detection, malicious file detection, file attribute detection, and compliance detection. Under some possible implementation methods, during the file transfer process, when the file security detection result indicates that the target file data is compliant, the FTP proxy device forwards the target file to the file receiving device. Under some possible implementation methods, if the file security detection result indicates that the target file data is in violation of regulations, the FTP proxy device will disconnect the data connection between the file receiving device and the file sending device, and end the file transfer process.

[0052] In one possible implementation, the specific process of obtaining the connection timeout period of the file receiving device may include: obtaining a target identity identifier of the file receiving device; matching the target identity identifier with a correspondence between a preset identity identifier and a connection timeout period; if the match is successful, obtaining the corresponding connection timeout period based on the correspondence between the matched identity identifier and the connection timeout period; or, if the match is unsuccessful, using the preset duration as the connection timeout period.

[0053] When the file receiving device is an FTP client, the target identity may be the user name and IP address of the client; when the file receiving device is an FTP server, the target identity may be the name and IP address of the FTP server. The preset duration is a pre-configured time interval.

[0054] The correspondence between the preset identity identifier and the connection timeout period in the above embodiment can be stored in a database. And the correspondence between the identity identifier and the connection timeout period in the database can be continuously updated. Figure 3As shown, the database updating method includes: obtaining a first duration from the establishment of a data connection between an FTP proxy device and a file receiving device to the disconnection due to a timeout exception, and obtaining a target identity of the file receiving device; matching the target identity with an identity stored in a database; if the match is successful, updating the connection timeout corresponding to the target identity in the database to the first duration; or, if the match is unsuccessful, using the first duration as the connection timeout, and establishing a corresponding relationship between the target identity and the first duration in the database.

[0055] For example, during the process of uploading a file, the FTP server disconnects the data connection with the FTP proxy device because it has not received file data for a long time; at this time, the FTP proxy device obtains the first duration from the establishment of the data connection between the FTP proxy device and the FTP server to the disconnection due to the timeout exception, the name and IP address of the FTP server, and matches the name and IP address of the FTP server with the pre-stored identity in the database; if the match is successful, the connection timeout corresponding to the target identity in the database is updated to the first duration; if the match is unsuccessful, the name and IP address of the FTP server are used as the primary key, and the first duration is used as the data associated with the primary key and stored in the database. Among them, the primary key is a unique identifier of the data, which is used to directly access the data associated with it.

[0056] In the above embodiment, by dynamically updating the identity identification and connection timeout in the database, the connection timeout in the database can adapt to different needs and scenarios, which can reduce the problem of inaccurate timeout judgment caused by replacing the file receiving device or manually modifying the timeout of the file receiving device, improve the adaptability of the connection timeout, and thus improve the stability of file transmission.

[0057] Step S300: Whenever the timing duration reaches the connection timeout period, heartbeat data is sent to the file receiving device and the timing is reset.

[0058] The heartbeat data is used to enable the file receiving device to maintain a data connection with the FTP proxy device.

[0059] In a possible implementation, the FTP proxy device includes a timeout callback function. The sending of heartbeat data to the file receiving device in the above step S300 can be: triggering the timeout callback function, and sending heartbeat data to the file receiving device. The triggering of the timeout callback function can be triggered by the FTP proxy device, or by a timer in the FTP proxy device.

[0060] The function of the timeout callback function is to obtain data connection information and heartbeat data information when the timing time reaches the connection timeout time, and send heartbeat data to the file receiving device according to the data connection information. The data connection information may include information such as the identity of the file receiving device, the data connection state, and the transmission mode; the heartbeat data information may include information such as the content of the heartbeat data and the number of bytes of the heartbeat data sent. In one embodiment, the data connection information and the heartbeat data information may be stored in a private session structure, which is generated when a data connection is established between the FTP proxy device and the file receiving device.

[0061] In one possible implementation, the heartbeat data may be data that is not related to the target file to be transmitted. In one possible implementation, the heartbeat data may be the first data of the target file to be transmitted. In this implementation, the file transmission method provided in the embodiment of the present application also includes: Figure 4 Steps shown:

[0062] Step S10: Record the number of bytes of the heartbeat data sent each time, wherein the heartbeat data sent each time is data at different positions in the first data.

[0063] The number of bytes sent each time is the same, and the specific number of bytes can be set as needed. For example, the number of bytes of the heartbeat data sent each time includes but is not limited to 1 byte.

[0064] Step S20: When the target file is transmitted to the file receiving device, the data in the target file is offset by the number of bytes before being transmitted to the file receiving device.

[0065] The above embodiment is described below by an example. If the size of the target file to be transmitted is 1024 bytes. The first data of the target file to be transmitted is "The quick brown fox jumps over the lazydog", which is 35 bytes in total, as heartbeat data. When the timing duration reaches the connection timeout time, if the FTP proxy device has not yet completed the cache and safety detection of the target file at this time, then send 1 byte, i.e. "T", to the file receiving device, and re-time, and continue to cache the target file. When the timing duration reaches the connection timeout time again, if the FTP proxy device has not yet completed the cache and safety detection of the target file at this time, then send 1 byte, i.e. "h", to the file receiving device, and re-time, and continue to cache the target file. Until the FTP proxy device completes the cache and safety detection of the target file. If during the file transmission process, the number of bytes sent is 5 bytes. Then, when the file security detection result indicates that the data of the target file is compliant, when the target file is transmitted to the file receiving device, the data in the target file is offset by the number of heartbeat bytes that have been sent, that is, after the target file is offset by 5 bytes, the remaining 1019 bytes are transmitted to the file receiving device.

[0066] By sending the first data of the target file to be transmitted as heartbeat data to the file receiving device, the possibility of the file receiving device generating dirty data to damage the file can be reduced, and the heartbeat function is realized while sending the file data, which reduces the loss of resources, improves the transmission efficiency, and ensures the integrity of the file. Dirty data refers to invalid, erroneous, and meaningless data. Dirty data may be generated due to a variety of reasons, including but not limited to data input errors, system failures, data destruction, malicious attacks, etc.

[0067] The following will be combined Figure 5The principle diagram shown illustrates the principle of the file transfer method through an example. Take the case where the file is downloaded and the FTP proxy device caches and performs security detection on the target file as an example. For example, after the FTP proxy device establishes control connections with the FTP client and the FTP server respectively, the FTP proxy device obtains and parses the FTP command sent by the FTP client. When the FTP command is a download command, the FTP proxy device first blocks the forwarding of the FTP command, generates a command for obtaining the size of the target file to be transferred, sends the command for obtaining the size of the target file to be transferred to the FTP server, obtains the size of the target file to be transferred, and after obtaining the size of the target file to be transferred, forwards the FTP command to the FTP server. After the FTP server responds to the FTP command, the FTP proxy device establishes data connections with the FTP client and the FTP server respectively, starts timing, and determines whether the size of the target file to be transferred is greater than the predicted maximum detection file size. If yes, the target file is transparently transmitted to the FTP client; if no, the target file is cached and the cached target file is security detected. During the target file caching and security detection process, when the timing reaches the connection timeout, if the FTP proxy device has not completed the caching and security detection of the target file at this time, it sends heartbeat data to the FTP client and restarts the timing. This process is repeated until the FTP proxy device completes the caching and security detection of the target file. If the security detection result indicates that the data of the target file is compliant, and the heartbeat data is the first data of the target file to be transmitted, the target file to be transmitted is offset by the number of heartbeat bytes that have been sent and sent to the FTP client; if the security detection result indicates that the data of the target file is illegal, the FTP proxy device disconnects the data connection with the FTP client and FTP server respectively, and ends the file transfer process.

[0068] like Figure 6 As shown, Figure 6 The schematic diagram of the structure of a file transmission device 10 provided in an embodiment of the present application is shown. The file transmission device 10 comprises a timing module 11, an acquisition module 12 and a sending module 13. The above-mentioned FTP proxy device may comprise the file transmission device 10.

[0069] The timing module 11 is used to start timing when the FTP proxy device establishes a data connection with the file receiving device.

[0070] The acquisition module 12 is used to acquire the connection timeout period of the file receiving device during the file transmission process.

[0071] The sending module 13 is used to send heartbeat data to the file receiving device and restart the timing whenever the timing duration reaches the connection timeout period; wherein the heartbeat data is used to enable the file receiving device to maintain a data connection with the FTP proxy device.

[0072] In one possible implementation, the acquisition module 12 is also used to acquire and parse the FTP command sent by the FTP client, wherein the FTP client is a file receiving device when the file is downloaded, and the FTP client is a file sending device when the file is uploaded; when the FTP command is a download command, the target file size is acquired from the file sending device, and after the target file size is acquired, the FTP command is forwarded to the file sending device; or, a command for acquiring the target file size is generated, and the command for acquiring the target file size and the FTP command are forwarded to the file sending device; after the file sending device responds to the FTP command, the FTP proxy device establishes data connections with the file receiving device and the file sending device, respectively.

[0073] In one possible implementation, the acquisition module 12 is specifically used to obtain the target identity of the file receiving device; match the target identity with the correspondence between the preset identity and the connection timeout; if the match is successful, the corresponding connection timeout is obtained based on the correspondence between the matched identity and the connection timeout; or, if the match is unsuccessful, the preset duration is used as the connection timeout.

[0074] In one possible implementation, the acquisition module 12 is also used to obtain a first duration from the establishment of a data connection between the FTP proxy device and the file receiving device to the disconnection due to a timeout exception, and to obtain a target identity of the file receiving device; match the target identity with the identity stored in a database; if the match is successful, update the connection timeout corresponding to the target identity in the database to the first duration; or, if the match is unsuccessful, use the first duration as the connection timeout, and establish a corresponding relationship between the target identity and the first duration in the database.

[0075] In a possible implementation manner, the sending module 13 is further used to determine whether the size of the target file to be transmitted is greater than a preset maximum detection file size; if so, transparently transmit the target file to the file receiving device.

[0076] In one possible implementation, the sending module 13 is also used to record the number of bytes of the heartbeat data sent each time, wherein the heartbeat data sent each time is data at a different position in the first data; when the target file is transmitted to the file receiving device, the data in the target file is offset by the number of bytes and then transmitted to the file receiving device.

[0077] In a possible implementation manner, the sending module 13 is specifically configured to trigger a timeout callback function and send heartbeat data to the file receiving device.

[0078] The file transfer device 10 provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned method embodiment. For the sake of brief description, for matters not mentioned in the device embodiment, reference may be made to the corresponding contents in the aforementioned method embodiment.

[0079] like Figure 7 As shown, Figure 7 The schematic diagram of the structure of an FTP proxy device 20 provided in an embodiment of the present application is shown. The FTP proxy device 20 comprises: a processor 21 and a memory 22.

[0080] Figure 7 The components and structure of the FTP proxy device 20 shown are merely exemplary and non-limiting. The FTP proxy device 20 may also have other components and structures as required.

[0081] The processor 21, the memory 22, and other components that may appear in the FTP proxy device 20 are directly or indirectly electrically connected to each other to achieve data transmission or interaction. For example, the processor 21, the memory 22, and other components that may appear may be electrically connected to each other via one or more communication buses or signal lines.

[0082] The memory 22 is used to store programs, for example, the program corresponding to the file transfer method mentioned above is stored.

[0083] The processor 21 is used to call the program stored in the memory to execute the file transmission method mentioned above.

[0084] Among them, the memory 22 can be, but is not limited to, random access memory (Random Access Memory, RAM), read only memory (Read Only Memory, ROM), programmable read-only memory (Programmable Read-Only Memory, PROM), erasable programmable read-only memory (Erasable Programmable Read-Only Memory, EPROM), electrically erasable read-only memory (Electric Erasable Programmable Read-Only Memory, EEPROM), etc.

[0085] The processor 21 may be an integrated circuit chip with signal processing capabilities. The above-mentioned processor 21 may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), a graphics processor (GPU), an accelerated processing unit (Accelerated Processing Unit), a multimedia application processor (MAP), a microprocessor, etc.; it may also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The disclosed methods, steps and logic block diagrams in the embodiments of the present application can be implemented or executed. Or the processor 21 may also be any conventional processor, etc.

[0086] The FTP proxy device 20 mentioned above includes but is not limited to an FTP proxy server, a data transfer device with FTP proxy function, etc.

[0087] The embodiment of the present application also provides a non-volatile computer-readable storage medium (hereinafter referred to as storage medium), on which a computer program is stored. When the computer program is run by a computer such as the above-mentioned FTP proxy device 20, the method disclosed in any of the above-mentioned embodiments is executed.

[0088] The embodiment of the present application also provides a computer program product, which includes a computer program. When the computer program is run by a computer such as the above-mentioned FTP proxy device 20, it executes the method disclosed in any of the above-mentioned embodiments.

[0089] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0090] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can also be implemented in other ways. The device embodiments described above are merely schematic. For example, the flowcharts and block diagrams in the accompanying drawings show the possible architecture, functions and operations of the devices, methods and computer program products according to multiple embodiments of the present application. In this regard, each box in the flowchart or block diagram can represent a module, a program segment or a part of a code, and the module, a program segment or a part of a code contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two consecutive boxes can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram and / or flowchart, and the combination of boxes in the block diagram and / or flowchart can be implemented with a dedicated hardware-based system that performs a specified function or action, or can be implemented with a combination of dedicated hardware and computer instructions.

[0091] In addition, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0092] If the functions are implemented in the form of software function modules and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a computer-readable storage medium, including several instructions for enabling a computer device (which can be a personal computer, a laptop, a server, or an electronic device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present application. The aforementioned computer-readable storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0093] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.

Claims

1. A file transmission method, characterized in that: Applied to an FTP proxy device, the method comprises: When the FTP proxy device establishes a data connection with the file receiving device, starting the timing; During the file transfer process, obtaining a connection timeout period of the file receiving device; Whenever the timing duration reaches the connection timeout time, heartbeat data is sent to the file receiving device and the timing is restarted; wherein the heartbeat data is used to enable the file receiving device to maintain a data connection with the FTP proxy device.

2. The method according to claim 1, characterized in that The file transmission includes file downloading, and the method further includes: Determine whether the size of the target file to be transferred is greater than the preset maximum detection file size; If yes, transparently transmit the target file to the file receiving device.

3. The method according to claim 2, characterized in that The FTP proxy device is respectively connected to the file receiving device and the file sending device for control, and the method further includes: Acquire and parse the FTP command sent by the FTP client, wherein the FTP client is a file receiving device when the file is downloaded, and the FTP client is a file sending device when the file is uploaded; In the case where the FTP command is a download command, the target file size is obtained from the file sending device, and after the target file size is obtained, the FTP command is forwarded to the file sending device; or, a command for obtaining the target file size is generated, and the command for obtaining the target file size and the FTP command are forwarded to the file sending device; After the file sending device responds to the FTP command, the FTP proxy device establishes data connections with the file receiving device and the file sending device respectively.

4. The method according to claim 1, characterized in that: The heartbeat data is the first piece of data of the target file to be transmitted, and the method further includes: Record the number of bytes of the heartbeat data sent each time, wherein the heartbeat data sent each time is data at different positions in the first data; When the target file is transmitted to the file receiving device, the data in the target file is offset by the number of bytes before being transmitted to the file receiving device.

5. The method according to claim 1, characterized in that The obtaining of the connection timeout period of the file receiving device comprises: Obtaining a target identity of the file receiving device; Matching the target identity with a corresponding relationship between a preset identity and a connection timeout period; If the match is successful, then based on the correspondence between the matched identity identifier and the connection timeout time, the corresponding connection timeout time is obtained; or, If the match is unsuccessful, the preset duration is used as the connection timeout.

6. The method according to claim 5, characterized in that The correspondence between the preset identity identifier and the connection timeout period is stored in a database, and the method further includes: Obtaining a first duration from establishment of a data connection between the FTP proxy device and the file receiving device to abnormal disconnection due to a timeout, and obtaining a target identity of the file receiving device; Matching the target identity with the identity stored in the database; If the match is successful, the connection timeout time corresponding to the target identity in the database is updated to the first time length; or, If the match is unsuccessful, the first duration is used as the connection timeout period, and a corresponding relationship between the target identity and the first duration is established in the database.

7. The method according to claim 1, characterized in that The FTP proxy device includes a timeout callback function, and the sending of heartbeat data to the file receiving device includes: The timeout callback function is triggered to send heartbeat data to the file receiving device.

8. An FTP proxy device, characterized in that: include: A memory and a processor, wherein the processor is connected to the memory; The memory is used to store programs; The processor is used to call the program stored in the memory to execute the method according to any one of claims 1 to 7.

9. A computer-readable storage medium, characterized in that: A computer program is stored thereon, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is executed.

10. A computer program product, characterized in that The computer program product comprises a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 7 is performed.