Data transmission method and module, computer equipment and computer storage medium
By re-requesting the server to allocate temporary ports and compare port numbers when the FTP client detects a business exception, the upload and download failure caused by temporary port conflict in FTP passive mode is solved, and a more stable file transfer is achieved.
Patent Information
- Application Number
- CN202510648182.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-19
- Publication Date
- 2025-07-25
AI Technical Summary
The existing FTP client is unavailable due to temporary port conflicts or other reasons in passive mode, resulting in the failure of uploading and downloading services.
When an abnormality of the file transfer protocol service is detected, the client sends a passive mode request message to the server again, causing the server to reassign a temporary port, and compares the new and old port numbers. If it is inconsistent, use the new port for file transfer protocol service, and if it is consistent, the request message will be resent.
By reassigning temporary ports, upload and download service failures caused by temporary port conflicts or other reasons in FTP passive mode are reduced.
Smart Images

Figure CN120378422A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a data transmission method, module, computer device and computer storage medium. Background Art
[0002] FTP (File Transfer Protocol) is a protocol for file transfer on the network, which allows users to transfer files from one computer to another. FTP is based on a client-server architecture. The FTP client connects to the FTP server and then uploads and downloads files. FTP uses two ports for communication, one for the control connection (the default port is 21) and the other for data transmission. The control connection is used to send commands and receive responses from the server, and the data connection is used for actual file transfer. When an existing FTP client connects to an FTP server program, in passive mode, after the FTP client initiates a PASV request message, the FTP server program only allocates a temporary port to the FTP client once for the next FTP service connection. If the temporary port allocated by the FTP server program to the FTP client conflicts with other program ports on the device where the FTP server program is located, the FTP client will be abnormally connected to the FTP server program, and the upload and download services will fail.
[0003] Therefore, how to reduce the upload and download service failures caused by temporary port unavailability due to temporary port conflicts or other reasons in the FTP passive mode has become a technical problem that needs to be solved urgently by those skilled in the art. Summary of the invention
[0004] The purpose of the present application is to provide a data transmission method, module, computer device and computer storage medium, which can reduce the failure of upload and download services caused by temporary port unavailability due to temporary port conflicts or other reasons in FTP passive mode.
[0005] In order to solve the above technical problems, the present application provides a data transmission method, including:
[0006] When a file transfer protocol service anomaly is detected, a passive mode request message is resent to the server so that the server reassigns a temporary port to the client;
[0007] Compare the temporary port newly allocated by the server to the client with the temporary port previously allocated by the server to the client;
[0008] If the temporary port re - allocated by the server for the client is inconsistent with the temporary port previously allocated by the server for the client, then use the temporary port re - allocated by the server for the client to conduct File Transfer Protocol (FTP) services;
[0009] If the temporary port re - allocated by the server for the client is consistent with the temporary port previously allocated by the server for the client, then re - send a Passive Mode Request message to the server.
[0010] In some embodiments, it further includes:
[0011] Count the number of times of sending the Passive Mode Request message to the server;
[0012] If the number of times of sending the Passive Mode Request message to the server reaches a first threshold, then disconnect the File Transfer Protocol connection.
[0013] In some embodiments, it further includes:
[0014] If there is an abnormality in conducting File Transfer Protocol services using the temporary port re - allocated by the server for the client, then re - send a Passive Mode Request message to the server.
[0015] In some embodiments, it further includes:
[0016] Count the number of times of abnormalities in conducting File Transfer Protocol services using the temporary port allocated by the server for the client;
[0017] If the number of times of abnormalities in conducting File Transfer Protocol services using the temporary port allocated by the server for the client reaches a second threshold, then disconnect the File Transfer Protocol connection.
[0018] In some embodiments, it further includes:
[0019] Cache the information of the temporary port allocated by the server for the client.
[0020] In some embodiments, it further includes:
[0021] After disconnecting the File Transfer Protocol connection, clear the cached information of the temporary port allocated by the server for the client.
[0022] In some embodiments, conducting File Transfer Protocol services using the temporarily re - allocated port of the server includes:
[0023] Establish a Transmission Control Protocol connection with the server using the temporarily re - allocated port of the server;
[0024] After establishing a Transmission Control Protocol (TCP) connection with the server using the temporary port reallocated by the server, perform File Transfer Protocol (FTP) services.
[0025] To solve the above technical problems, the present application also provides a data transmission module, including:
[0026] A first sending unit, configured to, when detecting an abnormal FTP service, resend a passive mode request message to the server to enable the server to reallocate a temporary port for the client;
[0027] A comparison unit, configured to compare the temporary port reallocated by the server for the client with the temporary port previously allocated by the server for the client;
[0028] A service execution unit, configured to, if the temporary port reallocated by the server for the client is inconsistent with the temporary port previously allocated by the server for the client, perform the FTP service using the temporary port reallocated by the server for the client;
[0029] A second sending unit, configured to, if the temporary port reallocated by the server for the client is consistent with the temporary port previously allocated by the server for the client, resend a passive mode request message to the server.
[0030] To solve the above technical problems, the present application also provides a computer device, including:
[0031] A memory, configured to store a computer program;
[0032] A processor, configured to implement the steps of the data transmission method as described above when executing the computer program.
[0033] To solve the above technical problems, the present application also provides a computer storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the steps of the data transmission method as described above are implemented.
[0034] The data transmission method provided by this application includes: when detecting an abnormal File Transfer Protocol (FTP) service, resending a passive mode request message to the server to enable the server to reassign a temporary port for the client; comparing the temporary port reassigned by the server for the client with the temporary port previously assigned by the server for the client; if the temporary port reassigned by the server for the client is inconsistent with the temporary port previously assigned by the server for the client, using the temporarily reassigned port by the server for the FTP service; if the temporarily reassigned port by the server for the client is consistent with the temporary port previously assigned by the server for the client, resending a passive mode request message to the server.
[0035] It can be seen that in the data transmission method provided by this application, when an abnormal FTP service occurs, the client resends a passive mode request message to the server to enable the server to reassign a temporary port. For the temporarily reassigned port by the server, the client will compare it with the temporary port previously assigned by the server. If the temporarily reassigned port by the server is consistent with the temporary port previously assigned by the server, it indicates that the temporarily reassigned port by the server is the temporary port for the previous abnormal FTP service. At this time, a passive mode request message is resent to the server. If the temporarily reassigned port by the server is inconsistent with the temporary port previously assigned by the server, an attempt is made to use the temporarily reassigned port by the server for the FTP service. By resending the passive mode request message to request the server to reassign a temporary port, a suitable temporary port can be assigned for the FTP service, reducing the failure of upload and download services caused by temporary port conflicts or other reasons that make the temporary port unavailable in the FTP passive mode.
[0036] The data transmission module, computer device, and computer storage medium provided by this application all have the above technical effects. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] In order to more clearly illustrate the technical solutions in the embodiments of this application, the following will briefly introduce the drawings required for the prior art and the embodiments. Obviously, the drawings in the following description are only some embodiments of this application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0038] Figure 1 It is a schematic flowchart of a data transmission method provided by an embodiment of this application;
[0039] Figure 2 It is an interaction schematic diagram between a client and a server provided by an embodiment of this application;
[0040] Figure 3 Schematic diagram of a data transmission module provided by an embodiment of the present application;
[0041] Figure 4 Schematic diagram of a computer device provided by an embodiment of the present application. Detailed implementation manners
[0042] The core of the present application is to provide a data transmission method, a computer device, and a computer storage medium, which can reduce the failure of upload and download services caused by temporary port conflicts or other reasons that make the temporary port unavailable in the FTP passive mode.
[0043] To make the objectives, technical solutions, and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present application. Apparently, the described embodiments are some, but not all, of the embodiments of the present application. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present application without creative efforts shall fall within the protection scope of the present application.
[0044] Please refer to Figure 1 , Figure 1 Schematic flowchart of a data transmission method provided by an embodiment of the present application. Referring to Figure 1 as shown, the method includes:
[0045] S101: When detecting an abnormal File Transfer Protocol (FTP) service, resend a passive mode request message to the server to enable the server to reassign a temporary port for the client;
[0046] S102: Compare the temporary port reassigned by the server for the client with the temporary port previously assigned by the server for the client;
[0047] S103: If the temporary port reassigned by the server for the client is different from the temporary port previously assigned by the server for the client, use the temporary port reassigned by the server for the client to perform the FTP service;
[0048] S104: If the temporary port reassigned by the server for the client is the same as the temporary port previously assigned by the server for the client, resend a passive mode request message to the server.
[0049] The data transmission method provided in this embodiment is applied to an FTP client. The client in the above text is an FTP client, and the server is an FTP server. When an FTP service exception occurs in the FTP client, it can resend a PASV request message to the FTP server without re-authenticating the username and password. The FTP server assigns a temporary port randomly, and it can randomly select an idle port within the specified port range for assignment.
[0050] After the FTP client completes FTP authentication, the FTP client sends a PASV request message, that is, a passive mode request message, to the FTP server. The FTP server assigns a temporary port to the FTP client. Then the FTP client connects to the assigned temporary port to perform FTP services, that is, File Transfer Protocol services. When the FTP client detects an exception in the File Transfer Protocol service, the FTP client resends a passive mode request message to the FTP server, and then the FTP server reassigns a temporary port to the FTP client.
[0051] After the FTP client receives the temporarily reassigned port from the FTP server, it compares the temporarily reassigned port that the FTP server has reassigned to the FTP client with the temporarily assigned port that the FTP server had previously assigned to the FTP client. If the port number of the temporarily reassigned port that the FTP server has reassigned to the FTP client is inconsistent with the port number of the temporarily assigned port that the FTP server had previously assigned to the client, then the FTP client attempts to use the temporarily reassigned port that the FTP server has reassigned to the FTP client to perform File Transfer Protocol services. If the port number of the temporarily reassigned port by the FTP server is the same as the port number of the temporarily assigned port by the FTP server previously, indicating that the temporarily assigned port for the File Transfer Protocol service exception has been allocated, then the FTP client resends a PASV request message to the FTP server to enable the FTP server to reassign a temporary port to the FTP client.
[0052] In some embodiments, it further includes:
[0053] Count the number of times of sending a passive mode request message to the server;
[0054] If the number of times of sending a passive mode request message to the server reaches the first threshold, disconnect the File Transfer Protocol connection.
[0055] To avoid occupying resources for a long time, this embodiment limits the number of times the FTP client sends a passive mode request message. The FTP client counts the number of times it sends a passive mode request message to the FTP server. If the number of times the FTP client sends a passive mode request message to the FTP server reaches the first threshold, the FTP client disconnects the entire FTP connection and releases the server port resources.
[0056] For the specific value of the first threshold, it can be set according to the actual application situation, and the present application does not limit this.
[0057] For example, the first threshold is 5, that is, the number of times to allow the passive mode request message to be initiated is 5 times. If the number of passive mode request messages sent by the FTP client to the FTP server reaches 5 times, the FTP client disconnects the entire FTP connection and releases resources.
[0058] The FTP client can count the number of times of initiating the passive mode request message through a counter. Each time the FTP client sends a passive mode request message, the counter makes a count. Before the FTP client can re-initiate the passive mode request message, it first determines whether the count value of the counter reaches the first threshold. If the count value of the counter reaches the first threshold, the FTP client abandons re-initiating the passive mode request message, disconnects the entire FTP connection, and releases the server port resources. If the count value of the counter does not reach the first threshold, the FTP client re-initiates the passive mode request message.
[0059] In some embodiments, it further includes:
[0060] If there is an abnormality in using the temporary port re-allocated by the server for the File Transfer Protocol service, a passive mode request message is re-sent to the server.
[0061] If the temporary port re-allocated by the FTP server for the FTP client is inconsistent with the temporary port previously allocated by the FTP server for the FTP client, the FTP client uses the temporary port re-allocated by the FTP server for the FTP client for the File Transfer Protocol service. If there is an abnormality when the FTP client uses the temporary port re-allocated by the server for the File Transfer Protocol service, the FTP client re-sends a passive mode request message to the FTP server so that the FTP server re-allocates the temporary port.
[0062] When the temporary port reallocated by the FTP server is the same as the temporary port previously allocated by the FTP server, the number of times the FTP client resends a passive mode request message to the server and the number of times the FTP client resends a passive mode request message to the FTP server when there is an abnormality in the File Transfer Protocol service using the temporary port reallocated by the FTP server can both be counted as the number of times of initiating a passive mode request message to the FTP server. Alternatively, when the temporary port reallocated by the FTP server is the same as the temporary port previously allocated by the FTP server, the number of times the FTP client resends a passive mode request message to the server and the number of times the FTP client resends a passive mode request message to the FTP server when there is an abnormality in the File Transfer Protocol service using the temporary port reallocated by the FTP server can be counted separately.
[0063] In some embodiments, it further includes:
[0064] Count the number of times of abnormality in the File Transfer Protocol service using the temporary port reallocated by the server;
[0065] If the number of times of abnormality in the File Transfer Protocol service using the temporary port reallocated by the server reaches a second threshold, disconnect the File Transfer Protocol connection.
[0066] In this embodiment, when there is an abnormality in the File Transfer Protocol service using the temporary port reallocated by the FTP server by the FTP client, the number of times the FTP client resends a passive mode request message to the FTP server is counted separately. If the number of times of abnormality in the File Transfer Protocol service using the temporary port reallocated by the FTP server by the FTP client reaches a second threshold, the FTP client disconnects the File Transfer Protocol connection.
[0067] For the specific value of the second threshold, it can be set according to the actual application situation, and the present application does not limit this.
[0068] For example, the second threshold is 3. If the number of times of abnormality in the File Transfer Protocol service using the temporary port reallocated by the FTP server by the FTP client reaches the second threshold, the FTP client disconnects the File Transfer Protocol connection and releases resources.
[0069] In some embodiments, it further includes:
[0070] Cache the information of the temporary port allocated by the server.
[0071] After the FTP client receives the temporary port assigned by the FTP server, it caches the information of the temporary port assigned by the FTP server locally, so that after reinitiating a passive mode request message subsequently, it can identify whether the previously abnormally temporary port for the file transfer protocol service is assigned again.
[0072] In some embodiments, it further includes:
[0073] After disconnecting the file transfer protocol connection, clear the information of the temporary port assigned by the server for the client cached.
[0074] When the number of times the passive mode request message sent by the FTP client to the FTP server reaches the first threshold and the FTP client disconnects the entire FTP connection, or when the number of times of abnormal file transfer protocol service using the temporarily port re-assigned by the FTP server reaches the second threshold and the FTP client disconnects the file transfer protocol connection, the FTP client clears the cached temporary port information.
[0075] In some embodiments, using the temporarily port re-assigned by the server for file transfer protocol service includes:
[0076] Establish a Transmission Control Protocol connection with the server using the temporarily port re-assigned by the server;
[0077] After establishing a Transmission Control Protocol connection with the server using the temporarily port re-assigned by the server, perform file transfer protocol service.
[0078] Establish a TCP (Transmission Control Protocol) connection with the server using the temporarily port re-assigned by the server and perform a three-way handshake. The first handshake: The FTP client sends a SYN packet to the FTP server to inform the FTP server that the FTP client wants to establish a connection. Specifically, the TCP protocol stack of the FTP client creates a TCP segment, and the SYN (Synchronize Sequence Numbers) in the flag bits of this TCP segment is set to 1. At the same time, the FTP client randomly generates an Initial Sequence Number (ISN) and places it in the sequence number field of the TCP segment. Then, the FTP client sends this TCP segment to the FTP server.
[0079] Second Handshake: The FTP server sends a SYN+ACK packet to the FTP client as a response. Specifically, the FTP server allocates TCP buffers and related resources for the connection. The FTP server randomly generates an initial sequence number and places it in the sequence number field of the TCP segment. At the same time, the FTP server adds 1 to the initial sequence number of the FTP client and places it in the acknowledgment number field of the TCP segment (indicating the acknowledgment of the client's SYN packet), and sets both the SYN and ACK (acknowledgment) flag bits to 1. Then, the FTP server sends the TCP segment to the FTP client.
[0080] Third Handshake: The FTP client sends an ACK packet to the FTP server to complete the establishment of the TCP connection.
[0081] After the FTP client establishes a TCP connection with the FTP server using the temporarily reallocated port of the FTP server, it conducts File Transfer Protocol services.
[0082] Reference Figure 2 As shown, the following describes a specific implementation manner of the interaction between the FTP client and the FTP server:
[0083] The FTP client conducts a three-way handshake to establish a TCP connection with the FTP server based on port 21.
[0084] First Handshake: The FTP client sends a SYN packet to the FTP server to inform the FTP server that the FTP client wants to establish a connection. Specifically, the TCP stack of the FTP client creates a TCP segment, and the SYN (Synchronize Sequence Numbers) in the flag bits of the TCP segment is set to 1. At the same time, the FTP client randomly generates an initial sequence number (ISN) and places it in the sequence number field of the TCP segment. Then, the FTP client sends the TCP segment to the FTP server.
[0085] Second Handshake: The FTP server sends a SYN+ACK packet to the FTP client as a response. Specifically, the FTP server allocates TCP buffers and related resources for the connection. The FTP server randomly generates an initial sequence number and places it in the sequence number field of the TCP segment. At the same time, the FTP server adds 1 to the initial sequence number of the FTP client and places it in the acknowledgment number field of the TCP segment (indicating the acknowledgment of the client's SYN packet), and sets both the SYN and ACK (acknowledgment) flag bits to 1. Then, the FTP server sends the TCP segment to the FTP client.
[0086] Third Handshake: The FTP client sends an ACK packet to the FTP server to complete the establishment of the connection.
[0087] Specifically, the FTP client adds 1 to the initial sequence number of the FTP server and puts it into the acknowledgment number field of the TCP segment (indicating the acknowledgment of the server's SYN+ACK packet), and sets the ACK flag to 1. Then, the FTP client sends the TCP segment to the FTP server. When the FTP server receives the ACK packet from the FTP client, it considers that the connection has been successfully established and the two parties can start data transmission.
[0088] After the three-way handshake is completed, the FTP client and the FTP server establish a command connection, and the FTP client requests the FTP server to allocate a temporary port. Exemplarily, as Figure 2 shown, the FTP client requests the FTP server to start a port with a port number > 1024 and wait passively for the data transmission channel connection.
[0089] The FTP client re-establishes a TCP connection with the FTP server using the temporary port allocated by the FTP server. The three-way handshake for re-establishing the TCP connection can refer to the above description, and this application will not elaborate here.
[0090] The FTP client conducts FTP services. If the FTP service verification passes, then after the FTP service is completed, the FTP client disconnects the FTP connection. If the FTP service verification fails, then the FTP client re-initiates a PASV request message to enable the FTP server to re-allocate a temporary port. The FTP client compares the temporary port re-allocated by the FTP server with the temporary port previously allocated by the FTP server for the FTP client. If the temporary port re-allocated by the FTP server for the FTP client is inconsistent with the temporary port previously allocated by the FTP server for the FTP client, then the FTP client uses the temporarily re-allocated port by the FTP server to conduct the File Transfer Protocol service.
[0091] If the temporarily re-allocated port by the FTP server is consistent with the temporarily allocated port by the FTP server previously, then the FTP client re-sends a passive mode request message to the server. Repeat this way until the number of times the FTP client repeats the PASV request message reaches the first threshold, and then the FTP client disconnects the FTP connection and releases resources.
[0092] In summary, for the data transmission method provided in this application, when a file transfer protocol service exception occurs, the client re-sends a passive mode request message to the server to enable the server to re-allocate a temporary port. For the temporarily allocated port re-allocated by the server, the client compares it with the temporary port previously allocated by the server. If the temporarily allocated port re-allocated by the server is the same as the temporary port previously allocated by the server, it indicates that the temporarily allocated port re-allocated by the server is the temporary port for the previous file transfer protocol service exception. At this time, a passive mode request message is re-sent to the server. If the temporarily allocated port re-allocated by the server is different from the temporary port previously allocated by the server, an attempt is made to use the temporarily allocated port re-allocated by the server for the file transfer protocol service. By re-initiating a passive mode request message to request the server to re-allocate a temporary port, a suitable temporary port can be allocated for the file transfer protocol service, reducing the failure of upload and download services caused by temporary port conflicts or other reasons that make the temporary port unavailable in the FTP passive mode.
[0093] This application also provides a data transmission module, and the module described below can be correspondingly referred to the method described above. Please refer to Figure 3 , Figure 3 FIG. is a schematic diagram of a data transmission module provided by an embodiment of this application. With reference to Figure 3 shown, the module includes:
[0094] A first sending unit 10, configured to re-send a passive mode request message to the server when detecting a file transfer protocol service exception, so that the server re-allocates a temporary port for the client;
[0095] A comparison unit 20, configured to compare the temporary port re-allocated by the server for the client with the temporary port previously allocated by the server for the client;
[0096] A service execution unit 30, configured to use the temporary port re-allocated by the server for the client to perform the file transfer protocol service if the temporary port re-allocated by the server for the client is different from the temporary port previously allocated by the server for the client;
[0097] A second sending unit 40, configured to re-send a passive mode request message to the server if the temporary port re-allocated by the server for the client is the same as the temporary port previously allocated by the server for the client.
[0098] The data transmission module may be an IOT device or an Internet of Things terminal device.
[0099] Based on the above embodiments, as a specific implementation manner, it further includes:
[0100] A first statistical unit, configured to count the number of times of sending a passive mode request message to the server;
[0101] A first disconnection unit, configured to disconnect the File Transfer Protocol (FTP) connection if the number of times of sending a passive mode request message to the server reaches a first threshold.
[0102] Based on the above embodiments, as a specific implementation manner, it further includes:
[0103] A third sending unit, configured to re - send a passive mode request message to the server if there is an abnormality in the File Transfer Protocol service using the temporary port re - allocated by the server for the client.
[0104] Based on the above embodiments, as a specific implementation manner, it further includes:
[0105] A second statistical unit, configured to count the number of times of abnormalities in the File Transfer Protocol service using the temporary port allocated by the server for the client;
[0106] A second disconnection unit, configured to disconnect the File Transfer Protocol connection if the number of times of abnormalities in the File Transfer Protocol service using the temporary port allocated by the server for the client reaches a second threshold.
[0107] Based on the above embodiments, as a specific implementation manner, it further includes:
[0108] A caching unit, configured to cache the information of the temporary port allocated by the server for the client.
[0109] Based on the above embodiments, as a specific implementation manner, it further includes:
[0110] A clearing unit, configured to clear the cached information of the temporary port allocated by the server for the client after disconnecting the File Transfer Protocol connection.
[0111] Based on the above embodiments, as a specific implementation manner, the service execution unit 30 includes:
[0112] A connection establishment unit, configured to establish a Transmission Control Protocol (TCP) connection with the server using the temporary port re - allocated by the server;
[0113] A file transfer unit, configured to perform File Transfer Protocol service after establishing a Transmission Control Protocol connection with the server using the temporary port re - allocated by the server.
[0114] This application also provides a computer device, refer to Figure 4As shown, the device includes a memory 101 and a processor 102.
[0115] The memory 101 is used for storing computer programs.
[0116] The processor 102 is used for executing the computer program to implement the following steps:
[0117] When a File Transfer Protocol (FTP) service exception is detected, resend a passive mode request message to the server so that the server reallocates a temporary port for the client; compare the temporary port reallocated by the server for the client with the temporary port previously allocated by the server for the client; if the temporary port reallocated by the server for the client is inconsistent with the temporary port previously allocated by the server for the client, then use the temporary port reallocated by the server for the client to perform the FTP service; if the temporary port reallocated by the server for the client is consistent with the temporary port previously allocated by the server for the client, then resend a passive mode request message to the server.
[0118] The computer device further includes one or more of a multimedia component 103, an information input / output (I / O) interface 104, and a communication component 105. The multimedia component 103 may include a screen and an audio component. The screen may be, for example, a touch screen, and the audio component is used for outputting and / or inputting audio signals. For example, the audio component may include a microphone for receiving external audio signals. The received audio signal may be further stored in the memory 102 or sent through the communication component 105. The audio component further includes at least one speaker for outputting audio signals. The I / O interface 104 provides an interface between the processor 101 and other interface modules, and the other interface modules may be a keyboard, a mouse, buttons, etc. These buttons may be virtual buttons or physical buttons. The communication component 105 is used for wired or wireless communication between the computer device and other devices. Wireless communication, such as Wi-Fi, Bluetooth, Near Field Communication (NFC), 2G, 3G, or 4G, or a combination of one or more of them. Accordingly, the communication component 105 may include: a Wi-Fi component, a Bluetooth component, an NFC component.
[0119] For the introduction of the device provided in this application, please refer to the above method embodiments, and details are not described herein again.
[0120] This application also provides a computer storage medium, on which a computer program is stored. When the computer program is executed by a processor, the following steps can be implemented:
[0121] When a File Transfer Protocol (FTP) service exception is detected, a passive mode request message is resent to the server so that the server re-assigns a temporary port for the client; the temporary port re-assigned by the server for the client is compared with the temporary port previously assigned by the server for the client; if the temporary port re-assigned by the server for the client is inconsistent with the temporary port previously assigned by the server for the client, the FTP service is performed using the temporary port re-assigned by the server for the client; if the temporary port re-assigned by the server for the client is consistent with the temporary port previously assigned by the server for the client, a passive mode request message is resent to the server.
[0122] The computer storage medium may include: various media 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 disc that can store program codes.
[0123] For the introduction of the computer storage medium provided in this application, please refer to the above method embodiments, and details are not described herein again.
[0124] The embodiments in the specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The same or similar parts among the embodiments can be referred to each other. For the devices, equipment, and computer storage media disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the descriptions are relatively simple. For the relevant parts, please refer to the description in the method part.
[0125] Those skilled in the art can further realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be implemented by electronic hardware, computer software, or a combination of the two. To clearly illustrate the interchangeability of hardware and software, the components and steps of each example have been generally described according to functions in the above description. Whether these functions are executed in a hardware or software manner depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered to exceed the scope of this application.
[0126] The steps of the method or algorithm described in combination with the embodiments disclosed herein can be directly implemented by hardware, a software module executed by a processor, or a combination of the two. The software module can be placed in a random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, a hard disk, a removable disk, a CD-ROM, or any other form of storage medium well-known in the technical field.
[0127] The data transmission method, module, computer device, and computer storage medium provided in this application have been introduced in detail above. Specific examples are used in this article to elaborate on the principle and implementation manner of this application. The description of the above embodiments is only used to help understand the method and its core idea of this application. It should be noted that for those of ordinary skill in the art, without departing from the principle of this application, several improvements and modifications can be made to this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. A data transmission method, characterized in that, Including: When a File Transfer Protocol (FTP) service exception is detected, resend a passive mode request message to the server so that the server reallocates a temporary port for the client; Compare the temporary port reallocated by the server for the client with the temporary port previously allocated by the server for the client; If the temporary port reallocated by the server for the client is different from the temporary port previously allocated by the server for the client, use the temporary port reallocated by the server for the client to perform the File Transfer Protocol service; If the temporary port reallocated by the server for the client is the same as the temporary port previously allocated by the server for the client, resend a passive mode request message to the server.
2. The data transmission method according to claim 1, wherein Also including: Count the number of times of sending the passive mode request message to the server; If the number of times of sending the passive mode request message to the server reaches a first threshold, disconnect the File Transfer Protocol connection.
3. The data transmission method according to claim 1, wherein Also including: If there is an exception when using the temporary port reallocated by the server for the client to perform the File Transfer Protocol service, resend a passive mode request message to the server.
4. The data transmission method according to claim 3, wherein Also including: Count the number of times of exceptions when using the temporary port allocated by the server for the client to perform the File Transfer Protocol service; If the number of times of exceptions when using the temporary port allocated by the server for the client to perform the File Transfer Protocol service reaches a second threshold, disconnect the File Transfer Protocol connection.
5. The data transmission method according to claim 1, characterized in that, Also including: Cache the information of the temporary port allocated by the server for the client.
6. The data transmission method according to claim 5, characterized in that Also including: After disconnecting the File Transfer Protocol connection, clear the cached information of the temporary port allocated by the server for the client.
7. The data transmission method according to claim 1, wherein Using the temporary port reallocated by the server to perform the File Transfer Protocol service includes: Establish a Transmission Control Protocol (TCP) connection with the server using the temporary port reallocated by the server; After establishing a Transmission Control Protocol connection with the server using the temporary port reallocated by the server, perform the File Transfer Protocol service.
8. A data transmission module, characterized in that, Including: A first sending unit, configured to resend a passive mode request message to the server when a File Transfer Protocol service exception is detected, so that the server reallocates a temporary port for the client; A comparison unit, configured to compare the temporary port reallocated by the server for the client with the temporary port previously allocated by the server for the client; A service execution unit, configured to use the temporary port reallocated by the server for the client to perform the File Transfer Protocol service if the temporary port reallocated by the server for the client is different from the temporary port previously allocated by the server for the client; A second sending unit, configured to resend a passive mode request message to the server if the temporary port reallocated by the server for the client is the same as the temporary port previously allocated by the server for the client.
9. A computer device, characterized in that, Including: A memory, configured to store a computer program; A processor, configured to implement the steps of the data transmission method according to any one of claims 1 to 7 when executing the computer program.
10. A computer storage medium, characterized in that, A computer program is stored on the computer storage medium, and when the computer program is executed by a processor, the steps of the data transmission method according to any one of claims 1 to 7 are implemented.