File transmission control method and device, electronic equipment and storage medium

By establishing file transfer and transfer control connections in a local area network (LAN) peer-to-peer transfer environment, and utilizing Socket connections, flexible control over file transfer is achieved, solving the problem of uncontrollable file transfer in a LAN environment and improving the flexibility and management capabilities of the transfer.

CN121644549APending Publication Date: 2026-03-10BEIJING CO WHEELS TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-29
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In a local area network environment, existing technologies cannot effectively control file transfer.

Method used

In a local area network peer-to-peer transmission environment, file transfer connections and transmission control connections are established, and Socket connections are used to realize the transmission of file transfer and transmission control commands, with data transmission and control performed independently.

Benefits of technology

It enables effective control over file transfer, including operations such as interruption, pause, resumption, and connection disconnection, thereby improving the flexibility and management capabilities of file transfer.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121644549A_ABST
    Figure CN121644549A_ABST
Patent Text Reader

Abstract

The embodiment of the invention discloses a file transmission control method and device, electronic equipment and a storage medium, and the method comprises the steps: responding to a connection request of a client in a point-to-point transmission environment of a local area network, and building file transmission connection and transmission control connection with the client; sending a target file to the client through the file transmission connection; sending a first transmission control instruction for the target file to the client through the transmission control connection, wherein the first transmission control instruction is used for instructing the client to perform transmission control on the target file; or, receiving a second transmission control instruction for the target file sent by the client through the transmission control connection, and performing transmission control on the target file according to the second transmission control instruction. According to the embodiment of the invention, the transmission control of the file transmitted by the file transmission connection is realized through the transmission control connection.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of communication technology, and in particular to a file transfer control method, apparatus, electronic device, and storage medium. Background Technology

[0002] In a local area network (LAN) environment, two devices can communicate. File transfer is possible when two devices communicate via a LAN; however, current technology does not allow for control over the transfer of files during LAN file transfers. Summary of the Invention

[0003] This application provides a file transfer control method, apparatus, electronic device, and storage medium, which can control the transfer of files.

[0004] To address the aforementioned problems, in a first aspect, embodiments of this application provide a file transfer control method, comprising:

[0005] In a local area network peer-to-peer transmission environment, in response to a client's connection request, a file transfer connection and a transmission control connection are established between the client and the client;

[0006] The target file is sent to the client via the file transfer connection;

[0007] The system sends a first transmission control instruction for the target file to the client via the transmission control connection, the first transmission control instruction being used to instruct the client to perform transmission control on the target file; or, the system receives a second transmission control instruction for the target file sent by the client via the transmission control connection, and performs transmission control on the target file according to the second transmission control instruction.

[0008] Secondly, embodiments of this application provide a file transfer control method, including:

[0009] In a local area network peer-to-peer transmission environment, a connection request is sent to the server. The connection request is used to request the establishment of a file transfer connection and a transmission control connection with the server.

[0010] Receive the target file sent by the server through the file transfer connection;

[0011] The system receives a first transmission control instruction for the target file sent by the server through the transmission control connection, and performs transmission control on the target file according to the first transmission control instruction; or, the system sends a second transmission control instruction for the target file to the server through the transmission control connection, the second transmission control instruction being used to instruct the server to perform transmission control on the target file.

[0012] Thirdly, embodiments of this application provide a file transfer control system, including:

[0013] The client is used to send connection requests to the server in a local area network point-to-point transmission environment;

[0014] The server is used to respond to the connection request and establish a file transfer connection and a transfer control connection with the client;

[0015] The server is also used to send the target file to the client through the file transfer connection;

[0016] The client is also used to receive a target file sent by the server through the file transfer connection;

[0017] The server is further configured to send a first transmission control instruction for the target file to the client via the transmission control connection, and the client is further configured to perform transmission control on the target file according to the first transmission control instruction; or, the client is further configured to send a second transmission control instruction for the target file to the server via the transmission control connection, and the server is further configured to perform transmission control on the target file according to the second transmission control instruction.

[0018] Fourthly, embodiments of this application provide a file transfer control device, including:

[0019] The connection establishment module is used to establish a file transfer connection and a transfer control connection with the client in response to the client's connection request in a local area network point-to-point transmission environment.

[0020] The file sending module is used to send the target file to the client through the file transfer connection;

[0021] The instruction transmission module is configured to send a first transmission control instruction for the target file to the client via the transmission control connection, the first transmission control instruction being used to instruct the client to perform transmission control on the target file; or, to receive a second transmission control instruction for the target file sent by the client via the transmission control connection, and to perform transmission control on the target file according to the second transmission control instruction.

[0022] Fifthly, embodiments of this application provide a file transfer control device, including:

[0023] The connection request sending module is used to send a connection request to the server in a local area network point-to-point transmission environment. The connection request is used to request the establishment of a file transfer connection and a transmission control connection with the server.

[0024] The file receiving module is used to receive the target file sent by the server through the file transfer connection;

[0025] The instruction transmission module is configured to receive a first transmission control instruction for the target file sent by the server through the transmission control connection, and to perform transmission control on the target file according to the first transmission control instruction; or, to send a second transmission control instruction for the target file to the server through the transmission control connection, wherein the second transmission control instruction is used to instruct the server to perform transmission control on the target file.

[0026] In a sixth aspect, embodiments of this application also provide an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the file transfer control method described in the first or second aspect.

[0027] In a seventh aspect, embodiments of this application provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the file transfer control method described in the first or second aspect.

[0028] The file transfer control method, apparatus, electronic device, and storage medium provided in this application establish a file transfer connection and a transfer control connection between the client and the server in a local area network point-to-point transmission environment. The target file is transferred through the file transfer connection, and the transfer control command is transmitted through the transfer control connection. The transfer control command can be used to control the transfer of the target file transmitted through the file transfer connection. The two connections transmit data independently, and the transfer control connection enables the transfer control of the file transmitted through the file transfer connection. Attached Figure Description

[0029] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0030] Figure 1 This is a flowchart of a file transfer control method provided in an embodiment of this application;

[0031] Figure 2 This is a flowchart of a file transfer control method provided in an embodiment of this application;

[0032] Figure 3This is a schematic diagram of the structure of a file transfer control system provided in an embodiment of this application;

[0033] Figure 4 This is a schematic diagram of the structure of a file transfer control device provided in an embodiment of this application;

[0034] Figure 5 This is a schematic diagram of the structure of a file transfer control device provided in an embodiment of this application;

[0035] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0036] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0037] Figure 1 This is a flowchart of a file transfer control method provided in an embodiment of this application. This file transfer control method can be applied to a server in two devices, where the server is used to send files, such as... Figure 1 As shown, the method includes steps 110 to 130.

[0038] Step 110: In a local area network peer-to-peer transmission environment, in response to the client's connection request, establish a file transfer connection and a transmission control connection with the client.

[0039] In this context, both the file transfer connection and the transmission control connection are Socket connections. Point-to-point transmission refers to data transmission directly between two devices on a network, without the need for an intermediate server or other intermediary. Local area network (LAN) point-to-point transmission refers to data transmission between two devices within the same local area network.

[0040] When the client and server are on the same local area network (LAN) and in a point-to-point transmission environment, they can establish file transfer connections and transmission control connections. During connection establishment, the client initiates a connection request, which may include the server's port number (and, in cases with many devices on the LAN, the server's IP address). The server responds to the connection request, establishing both the file transfer connection and the transmission control connection with the client based on the port number. The file transfer connection and transmission control connection can transmit data in parallel. The file transfer connection is used to transfer files, while the transmission control connection is used to transmit transmission control commands for the files transferred via the file transfer connection. The client can be a mobile terminal such as a smartphone or tablet, or it can be an in-vehicle terminal. The server can be an in-vehicle terminal, a mobile terminal, or similar devices.

[0041] It's important to note that before sending a connection request to the server, the client needs to obtain the server's port number. Then, it sends the connection request based on the server's port number. For example, when the client and server establish a connection via Wi-Fi, the server can display a QR code containing Wi-Fi information, the server's IP address, and port number based on a file transfer command triggered by the user. The client can scan the QR code provided by the server to obtain the server's Wi-Fi information, IP address, and port number. Based on the Wi-Fi information, a local area network connection is established between the client and server, and then the client initiates a connection request to the server using the IP address and port number. Alternatively, the client can obtain the server's IP address and port number through other methods, such as pre-negotiation between the two devices to allow the client to obtain the server's IP address and port number.

[0042] In one embodiment of this application, the connection request includes a first connection request and a second connection request, wherein the first connection request includes a first port number of the server and the second connection request includes a second port number of the server;

[0043] The step of establishing a file transfer connection and a transfer control connection with the client in response to a connection request from the client may include: establishing a file transfer connection with the client through the first port number in response to a first connection request from the client; and establishing a transfer control connection with the client through the second port number in response to a second connection request from the client.

[0044] The first port number identifies the port on the server that establishes the file transfer connection, and the second port number identifies the port on the server that establishes the transmission control connection. Port numbers are numerical identifiers used to distinguish different communication targets; a port can represent a communication target or a communication process.

[0045] In an exemplary embodiment, before establishing a file transfer connection and a transfer control connection with the client in response to a connection request from the client, the method may further include: creating a first service socket object, binding the first service socket object to the first port number, and creating a second service socket object, binding the second service socket object to the second port number; generating an information code including the server's IP address, the first port number, and the second port number, and displaying the information code so that the client can identify the information code to obtain the IP address, the first port number, and the second port number;

[0046] The step of establishing a file transfer connection and a transfer control connection with the client in response to a connection request from the client that recognizes the information code can include: establishing a file transfer connection and a transfer control connection with the client in response to a connection request generated by the client recognizing the information code.

[0047] The information code carries the server's IP address, first port number, and second port number, and may be, for example, a QR code or barcode.

[0048] When the server receives a trigger command from a user requesting file transfer, it first creates two service Socket objects (the Socket objects created by the server can be referred to as ServerSocket), namely the first service Socket object and the second service Socket object. The two service Socket objects listen for connection requests from the client and bind the two Socket objects to the server's IP address respectively. The first service Socket object is bound to the first port number, and the second service Socket object is bound to the second port number.

[0049] Generate and display an information code that includes the server's IP address, first port number, and second port number, so that the client can identify the information code, obtain the server's IP address, first port number, and second port number, and then initiate a connection request based on the server's IP address, first port number, and second port number.

[0050] After receiving a connection request from the client, the server establishes a file transfer connection and a transfer control connection with the client.

[0051] By creating a first service Socket object and a second service Socket object, and binding the first port number and the second port number respectively, an information code including the server's IP address, the first port number and the second port number is generated. This makes it easier for the client to obtain the server's connection information (i.e., IP address, the first port number and the second port number), and then initiate a connection request to establish a file transfer connection and a transfer control connection.

[0052] In one embodiment of this application, the step of establishing a file transfer connection and a transfer control connection with the client in response to the connection request generated by the client recognizing the information code may include:

[0053] The first service socket object listens for the first connection request sent by the client, which includes the first port number, and establishes a file transfer connection between the first service socket object and the first client socket object of the client through the first port number;

[0054] The second service Socket object listens for the second connection request sent by the client, which includes the second port number, and establishes a transport control connection between the second service Socket object and the client's second client Socket object through the second port number.

[0055] Each service socket object calls its own listener function (e.g., `accept()`) to wait for a client to connect. The client's first client socket object calls its connection function (e.g., `connect()`) to initiate a first connection request, including the first port number. The server's first service socket object, bound to the first port number, listens to the first connection request sent by the client through its first client socket object. It determines that the first port number in the first connection request is the same as the first port number bound to the first service socket object. At this point, a file transfer connection is established between the first service socket object and the client's first client socket object through the first port number. That is, after the connection is successful, the first service socket object bound to the first port number is used for file transfer. The client's second client socket object calls its connection function to initiate a second connection request, including the second port number. The server's second service socket object, bound to the second port number, listens to the second connection request sent by the client through its second client socket object. It determines that the second port number in the second connection request is the same as the second port number bound to its second service socket object. At this point, a transport control connection is established between the second service socket object and the client's second client socket object through the second port number. That is, after the connection is successful, the second service socket object bound to the second port number is used for transport control.

[0056] By including a first port number in the first connection request and a second port number in the second connection request, a file transfer connection and a transfer control connection can be established respectively based on the first port number and the second port number, so as to facilitate file transfer through the file transfer connection and transfer control of the transferred file through the transfer control connection.

[0057] It should be noted that the above is only for clarity. The connection established through the first port number is called the file transfer connection, and the connection established through the second port number is called the transfer control connection. However, this is not a limitation. In fact, after the two connections are successfully established, one connection can be used for file transfer, and the other connection can be used for transfer control.

[0058] Step 120: Send the target file to the client through the file transfer connection.

[0059] The server sends the target file to the client via a file transfer connection. The target file is a file stored in the server's local storage, and its file format is not limited; it can be a video, image, or text file. The server can send one or more target files. When there are multiple target files, they are transferred serially, meaning that one file is transferred via the file transfer connection before another file is transferred via the same connection.

[0060] In one embodiment of this application, sending the target file to the client via the file transfer connection may include: sending a file transfer message to the client via the file transfer connection, the file transfer message including a waiting transfer flag and file description information of the target file; and sending the target file to the client via the file transfer connection after receiving an agreement to receive message from the client via the file transfer connection.

[0061] The file description information describes the target file being transmitted and can be represented as a list, including information such as file size, filename, and MD5 value. The wait-to-transfer flag indicates that file transmission is pending.

[0062] The server sends a file transfer message to the client via a file transfer connection using a Socket object for file transfer. This message includes a waiting flag, file description information, and may also include a timestamp. The client receives the file transfer message via the Socket object, displays the file description information, and provides a control for the user to choose whether to accept the file. If the user chooses to accept, the client sends an acceptance message to the server via the file transfer connection. Upon receiving the acceptance message from the client, the server sends the target file to the client via the file transfer connection in the form of a data stream (Socket stream).

[0063] After the client displays the file description information, if the user chooses not to receive, the client sends a disagreement message to the server through the file transfer connection. After receiving the disagreement message from the client, the server stops sending the target file to be transferred.

[0064] The target file is transferred through communication between the server and the client. The user can determine whether the target file needs to be transferred, so the file transfer can be performed according to the user's needs.

[0065] Step 130: Send a first transmission control instruction for the target file to the client through the transmission control connection, the first transmission control instruction being used to instruct the client to perform transmission control on the target file; or, receive a second transmission control instruction for the target file sent by the client through the transmission control connection, and perform transmission control on the target file according to the second transmission control instruction.

[0066] The first transmission control instruction may include an interrupt transmission instruction, a pause transmission instruction, a resume transmission instruction, or a disconnection instruction. The second transmission control instruction may include an interrupt transmission instruction, a pause transmission instruction, a resume transmission instruction, or a disconnection instruction.

[0067] In one optional implementation, the server controls the transmission of the target file and can send a first transmission control instruction to the client via the transmission control connection regarding the target file being transmitted in the file transfer connection. Upon receiving the first transmission control instruction, the client can control the transmission of the target file. For example, when the first transmission control instruction is an interrupt transmission instruction, the server interrupts the transmission of the target file and sends an interrupt transmission instruction to the client via the transmission control connection. Upon receiving the interrupt transmission instruction, the client stops receiving the target file being transmitted in the file transfer connection. When the first transmission control instruction is a pause transmission instruction, the server pauses the transmission of the target file via the transmission control connection and sends a pause transmission instruction to the client via the transmission control connection. Upon receiving the pause transmission instruction, the client pauses receiving the target file being transmitted in the file transfer connection. When the first transmission control instruction is a resume transmission instruction, the server resumes the transmission of the target file from the paused position via the transmission control connection and sends a resume transmission instruction to the client. Upon receiving the resume transmission instruction, the client resumes receiving the target file being transmitted in the file transfer connection from the paused position. When the first transmission control instruction is a connection disconnect instruction, upon receiving the connection disconnect instruction, the client disconnects the file transfer connection and the transmission control connection between the server and the client.

[0068] In another alternative implementation, the client controls the transmission of the target file and can send a second transmission control command to the server through the transmission control connection. After receiving the second transmission control command, the server controls the transmission of the target file in the file transmission connection. For example, when the second transmission control command is an interrupt transmission command, the client stops receiving the target file from the file transfer connection and sends an interrupt transmission command to the server through the transmission control connection. After receiving the interrupt transmission command from the client through the transmission control connection, the server stops sending the target file through the file transfer connection. When the second transmission control command is a pause transmission command, the client pauses receiving the target file from the file transfer connection and sends a pause transmission command to the server through the transmission control connection. After receiving the pause transmission command from the client through the transmission control connection, the server pauses sending the target file through the file transfer connection. When the second transmission control command is a resume transmission command, the client resumes receiving the target file from the file transfer connection from the paused position and sends a resume transmission command to the server through the transmission control connection. After receiving the resume transmission command from the client through the transmission control connection, the server resumes sending the target file from the paused position through the file transfer connection. When the second transmission control command is a connection disconnect command, after receiving the connection disconnect command from the client through the transmission control connection, the server disconnects the file transfer connection and the transmission control connection between the server and the client.

[0069] The file transfer control method provided in this application establishes a file transfer connection and a transfer control connection with the client in response to the client's connection request. It then sends a target file to the client through the file transfer connection and sends a first transfer control instruction to the client through the transfer control connection, instructing the client to perform transfer control on the target file. Alternatively, it receives a second transfer control instruction from the client for the target file through the transfer control connection and performs transfer control on the target file according to the second transfer control instruction. Since the transfer control instruction can be transmitted through the transfer control connection during file transfer, transfer control of the transferred file is achieved.

[0070] Based on the above technical solution, after sending the target file to the client through the file transfer connection, it may further include: receiving a transmission completion message sent by the client through the transmission control connection, wherein the transmission completion message is used to notify that the target file has been transmitted successfully.

[0071] The server sends the target file, and the sending completion time is earlier than the client's receiving completion time. Therefore, when the server has finished sending the entire target file, the client has not yet finished receiving it. So, after the client has finished receiving the entire target file, it will actively send a transmission completion message to the server through the transmission control connection. After receiving the transmission completion message, the server can know that the target file transmitted by the file transfer connection has been successfully transmitted.

[0072] By receiving a transmission completion message from the client through the transmission control connection, the server can be informed that the target file has been successfully transmitted.

[0073] Based on the above technical solution, the method may further include:

[0074] During the transmission of the target file through the file transfer connection, after receiving the first heartbeat packet sent by the client through the transmission control connection, a second heartbeat packet is sent to the client after a first preset time.

[0075] The system receives the first heartbeat packet sent by the client again through the transmission control connection. The first heartbeat packet received again is sent by the client after the client has received the second heartbeat packet and after the first preset time has elapsed; or, if the system does not receive the first heartbeat packet sent by the client again after the second heartbeat packet has been sent to the client and after the second preset time has elapsed, the system ends the transmission of the target file to the client; the second preset time is longer than the first preset time.

[0076] To ensure that both the server and client know whether the other is online during the transfer of the target file, they will proactively send heartbeat packets. Specifically, the client first sends a first heartbeat packet to the server via the transmission control connection. Upon receiving the first heartbeat packet, the server starts timing. When the timing reaches a first preset time, the server sends a second heartbeat packet to the client via the transmission control connection. After receiving the second heartbeat packet from the server, the client will send the first heartbeat packet again after the first preset time. The server will then receive the first heartbeat packet from the client again via the transmission control connection, and after another first preset time, it will send the second heartbeat packet to the client. This cycle of sending and receiving second heartbeat packets and first heartbeat packets continues. Alternatively, if the server sends a second heartbeat packet to the client and does not receive a second first heartbeat packet from the client after the second preset time has elapsed, it considers the transmission control connection to be broken, stops sending the target file to be transferred to the client via the file transfer connection, and ceases sending second heartbeat packets via the transmission control connection.

[0077] By repeatedly sending and receiving heartbeat packets between the client and server, it is possible to determine whether the other party is online. If it is determined that the other party is offline, the transmission of the target file will be terminated in a timely manner, ensuring that normal transmission control commands can be transmitted through the transmission control connection.

[0078] It should be noted that after the file transfer is completed, the client or server can send a connection disconnect command to the other party to disconnect the file transfer connection and the transfer control connection. Then, when the file transfer is performed again, the file transfer connection and the transfer control connection will be re-established in the manner described in the embodiments of this application. Alternatively, after the file transfer is completed, the file transfer connection and the transfer control connection can be kept open. In this way, if there is a file to be transferred next time, the file transfer connection can be used directly for file transfer, and the transfer control connection can be used for transfer control.

[0079] Figure 2 This is a flowchart illustrating a file transfer control method provided in an embodiment of this application. This file transfer control method can be applied to clients in two devices, where the client is used to receive files, such as... Figure 2 As shown, the method includes steps 210 to 230.

[0080] Step 210: In a local area network peer-to-peer transmission environment, a connection request is sent to the server. The connection request is used to request the establishment of a file transfer connection and a transmission control connection between the server and the server.

[0081] Both the file transfer connection and the transfer control connection are Socket connections. Point-to-point transmission refers to data transmission between two devices directly on a network, without the need for an intermediate server or other intermediary. Local area network (LAN) point-to-point transmission refers to data transmission between two devices within the same local area network.

[0082] When the client and server are on the same local area network (LAN) and in a point-to-point transmission environment, they can establish file transfer connections and transmission control connections. During connection establishment, the client initiates a connection request, which may include the server's port number (and, in cases with many devices on the LAN, the server's IP address). The server responds to the connection request, thus establishing the file transfer connection and transmission control connection between the client and server. The file transfer connection and transmission control connection can transmit data in parallel. The file transfer connection is used to transfer files, and the transmission control connection is used to transmit transmission control commands for the files transferred via the file transfer connection. The client can be a mobile terminal such as a smartphone or tablet, or it can be an in-vehicle terminal. The server can be an in-vehicle terminal, a mobile terminal, or similar devices.

[0083] It's important to note that before sending a connection request to the server, the client needs to obtain the server's port number. Then, it sends the connection request based on the server's port number. For example, when the client and server establish a connection via Wi-Fi, the server can display a QR code containing Wi-Fi information, the server's IP address, and port number based on a file transfer command triggered by the user. The client can scan the QR code provided by the server to obtain the server's Wi-Fi information, IP address, and port number. Based on the Wi-Fi information, a local area network connection is established between the client and server, and then the client initiates a connection request to the server using the IP address and port number. Alternatively, the client can obtain the server's IP address and port number through other methods, such as pre-negotiation between the two devices to allow the client to obtain the server's IP address and port number.

[0084] In one embodiment of this application, the connection request includes a first connection request and a second connection request, wherein the first connection request includes a first port number of the server and the second connection request includes a second port number of the server;

[0085] Sending a connection request to the server includes: sending a first connection request to the server, the first connection request being used to request the establishment of a file transfer connection with the server; and simultaneously sending a second connection request to the server, the second connection request being used to request the establishment of a transmission control connection with the server.

[0086] The first port number identifies the port on the server that establishes the file transfer connection, and the second port number identifies the port on the server that establishes the transmission control connection. Port numbers are numerical identifiers used to distinguish different communication targets; a port can represent a communication target or a communication process.

[0087] In an exemplary embodiment, before sending a connection request to the server, the method may further include: identifying the information code displayed by the server, obtaining the server's IP address, first port number, and second port number; and creating a first client Socket object and a second client Socket object based on the first port number and the second port number.

[0088] Sending a connection request to the server may include: sending a connection request to the server corresponding to the IP address based on the first client Socket object and the second client Socket object.

[0089] When the server receives a trigger command from a user requesting file transfer, it first creates two Socket objects (the Socket objects created by the server can be denoted as ServerSocket), namely the first service Socket object and the second service Socket object. The server listens for connection requests from the client through the two Socket objects and binds the two Socket objects to the server's IP address, the first service Socket object to the first port number, and the second service Socket object to the second port number. The server then generates an information code that includes the server's IP address, the first port number, and the second port number, and displays the information code.

[0090] The client identifies the information code displayed by the server to obtain the server's IP address, first port number, and second port number. Based on the first and second port numbers, the client creates two client Socket objects: a first client Socket object and a second client Socket object. Using these two client Socket objects, the client sends a connection request to the server corresponding to the obtained IP address to request the establishment of a file transfer connection and a transfer control connection.

[0091] By recognizing the information code displayed by the server, the connection information of the server (i.e., IP address, first port number and second port number) can be obtained, and then a connection request can be initiated to establish a file transfer connection and a transfer control connection.

[0092] In one embodiment of this application, sending a connection request to the server corresponding to the IP address based on the first client Socket object and the second client Socket object may include: sending a first connection request including the first port number to the server corresponding to the IP address by calling a connection function through the first client Socket object;

[0093] Sending the second connection request to the server may include: sending a second connection request, including the second port number, to the server corresponding to the IP address by calling the connection function through the second client Socket object.

[0094] The first client Socket object can be used to establish a connection with the first service Socket object on the server via the first port number. The second client Socket object is used to establish a connection with the second service Socket object on the server via the second port number. The first client Socket object in the client calls the connection function (the connection function could be, for example, the connect() function) to send a first connection request to the server, including the first port number. The second client Socket object in the client calls the connection function to send a second connection request to the server, including the second port number.

[0095] When the server-side first service socket object, bound to the first port number, listens for the first connection request sent by the client through the first client socket object, and determines that the first port number in the first connection request is the same as the first port number bound to the first service socket object, a file transfer connection is established between the first service socket object and the client's first client socket object through the first port number. That is, after the connection is successful, the first service socket object bound to the first port number is used for file transfer. When the server-side second service socket object, bound to the second port number, listens for the second connection request sent by the client through the second client socket object, and determines that the second port number in the second connection request is the same as the second port number bound to the second service socket object, a transmission control connection is established between the second service socket object and the client's second client socket object through the second port number. That is, after the connection is successful, the second service socket object bound to the second port number is used for transmission control.

[0096] By including a first port number in the first connection request and a second port number in the second connection request, a file transfer connection and a transfer control connection can be established respectively based on the first port number and the second port number, so as to facilitate file transfer through the file transfer connection and transfer control of the transferred file through the transfer control connection.

[0097] It should be noted that the above is only for clarity. The connection established through the first port number is called the file transfer connection, and the connection established through the second port number is called the transfer control connection. However, this is not a limitation. In fact, after the two connections are successfully established, one connection can be used for file transfer, and the other connection can be used for transfer control.

[0098] Step 220: Receive the target file sent by the server through the file transfer connection.

[0099] The client receives the target file sent by the server through a file transfer connection. The target file sent by the server is a file stored in the server's local storage. The file format of the target file is not limited; it can be a video, image, text file, etc. The target file sent by the server can be one file or multiple files. When there are multiple target files, they are transferred serially, that is, one file is transferred through the file transfer connection, and then another file is transferred through the same file transfer connection.

[0100] In one embodiment of this application, receiving a target file sent by the server via the file transfer connection includes: receiving a file transfer message sent by the server via the file transfer connection, the file transfer message including a waiting transfer flag and file description information of the target file; displaying the file description information and receiving an acceptance instruction; sending an acceptance message to the server via the file transfer connection; and receiving the target file sent by the server via the file transfer connection.

[0101] The file description information describes the target file being transmitted and can be represented as a list, including information such as file size, filename, and MD5 value. The wait-to-transfer flag indicates that file transmission is pending.

[0102] The server sends a file transfer message to the client via a file transfer connection using a Socket object for file transfer. This message includes a waiting flag, file description information, and potentially a timestamp. The client receives the message through its own Socket object, displays the file description, and provides a control for the user to accept the file. If the user accepts, the client receives a confirmation message and sends it to the server via the file transfer connection. Upon receiving this confirmation message, the server sends the target file to the client as a data stream (Socket stream) via the file transfer connection. The client then receives the target file from the server via the file transfer connection.

[0103] After the client displays the file description information, if the user chooses not to receive it, the client receives the user's disagreement to receive instruction. At this time, the client sends a disagreement message to the server through the file transfer connection. After receiving the disagreement message from the client, the server stops sending the target file.

[0104] The target file is transferred through communication between the server and the client. The user can determine whether the file needs to be transferred, so the file transfer can be carried out according to the user's needs.

[0105] Step 230: Receive a first transmission control instruction for the target file sent by the server through the transmission control connection, and perform transmission control on the target file according to the first transmission control instruction; or, send a second transmission control instruction for the target file to the server through the transmission control connection, the second transmission control instruction being used to instruct the server to perform transmission control on the target file.

[0106] The first transmission control instruction may include an interrupt transmission instruction, a pause transmission instruction, or a resume transmission instruction. The second transmission control instruction may include an interrupt transmission instruction, a pause transmission instruction, or a resume transmission instruction.

[0107] In one optional implementation, the server controls the transmission of the target file and can send a first transmission control instruction to the client via the transmission control connection regarding the target file being transmitted in the file transfer connection. Upon receiving the first transmission control instruction, the client can control the transmission of the target file. For example, when the first transmission control instruction is an interrupt transmission instruction, the server interrupts the transmission of the target file and sends an interrupt transmission instruction to the client via the transmission control connection. Upon receiving the interrupt transmission instruction, the client stops receiving the target file being transmitted in the file transfer connection. When the first transmission control instruction is a pause transmission instruction, the server pauses the transmission of the target file via the transmission control connection and sends a pause transmission instruction to the client via the transmission control connection. Upon receiving the pause transmission instruction, the client pauses receiving the target file being transmitted in the file transfer connection. When the first transmission control instruction is a resume transmission instruction, the server resumes the transmission of the target file from the paused position via the transmission control connection and sends a resume transmission instruction to the client. Upon receiving the resume transmission instruction, the client resumes receiving the target file being transmitted in the file transfer connection from the paused position. When the first transmission control instruction is a connection disconnect instruction, upon receiving the connection disconnect instruction, the client disconnects the file transfer connection and the transmission control connection between the server and the client.

[0108] In another alternative implementation, the client controls the transmission of the target file and can send a second transmission control command to the server through the transmission control connection. After receiving the second transmission control command, the server controls the transmission of the target file in the file transmission connection. For example, when the second transmission control command is an interrupt transmission command, the client stops receiving the target file from the file transfer connection and sends an interrupt transmission command to the server through the transmission control connection. After receiving the interrupt transmission command from the client through the transmission control connection, the server stops sending the target file through the file transfer connection. When the second transmission control command is a pause transmission command, the client pauses receiving the target file from the file transfer connection and sends a pause transmission command to the server through the transmission control connection. After receiving the pause transmission command from the client through the transmission control connection, the server pauses sending the target file through the file transfer connection. When the second transmission control command is a resume transmission command, the client resumes receiving the target file from the file transfer connection from the paused position and sends a resume transmission command to the server through the transmission control connection. After receiving the resume transmission command from the client through the transmission control connection, the server resumes sending the target file from the paused position through the file transfer connection. When the second transmission control command is a connection disconnect command, after receiving the connection disconnect command from the client through the transmission control connection, the server disconnects the file transfer connection and the transmission control connection between the server and the client.

[0109] The file transfer control method provided in this application embodiment sends a connection request to the server and establishes a file transfer connection and a transfer control connection between the server and the server. It receives the target file transmitted by the server through the file transfer connection and receives the first transfer control instruction for the target file sent by the server through the transfer control connection, and performs transfer control on the target file. Alternatively, it sends a second transfer control instruction for the target file to the server through the transfer control connection to instruct the server to perform transfer control on the target file. Since the transfer control instruction can be transmitted through the transfer control connection during the transfer of the target file through the file transfer connection, the transfer control of the transmitted file is realized.

[0110] Based on the above technical solution, after receiving the target file sent by the server through the file transfer connection, it may further include: sending a transmission completion message to the server through the transmission control connection, wherein the transmission completion message is used to notify the server that the target file has been transmitted successfully.

[0111] The server sends the target file, and the sending completion time is earlier than the client's receiving completion time. Therefore, when the server has finished sending the entire target file, the client has not yet finished receiving it. So, after the client has finished receiving the entire target file, it will actively send a transmission completion message to the server through the transmission control connection. After receiving the transmission completion message, the server can know that the target file transmitted by the file transfer connection has been successfully transmitted.

[0112] Sending a transmission completion message to the server via the transmission control connection allows the server to know that the target file has been successfully transmitted.

[0113] Based on the above technical solution, the method may further include: during the transmission of the target file through the file transfer connection, sending a first heartbeat packet to the server through the transmission control connection; after receiving a second heartbeat packet sent by the server through the transmission control connection and waiting for a first preset time, sending the first heartbeat packet to the server again; or, after sending the first heartbeat packet to the server and not receiving a second heartbeat packet sent by the server after a second preset time, ending the sending of the first heartbeat packet to the server and stopping the reception of the target file through the file transfer connection; the second preset time is greater than the first preset time.

[0114] To ensure that both the server and client know each other's online status during file transfer, they proactively send heartbeat packets. Specifically, the client first sends a first heartbeat packet to the server via the transmission control connection. After the client sends the first heartbeat packet, the server receives it and starts a timer. When the timer reaches a first preset time, the server sends a second heartbeat packet to the client via the transmission control connection. The client receives the second heartbeat packet and starts a timer. When the timer reaches the first preset time, the client again sends the first heartbeat packet to the server via the transmission control connection. The server again receives the first heartbeat packet from the client via the transmission control connection. After another first preset time, the server sends the second heartbeat packet to the client again. This cycle of sending and receiving heartbeat packets continues. Alternatively, if the client sends the first heartbeat packet and does not receive the second heartbeat packet from the server after the second preset time, it considers the transmission control connection to be broken, stops sending the first heartbeat packet to the server via the transmission control connection, and stops receiving the target file via the file transfer connection.

[0115] By repeatedly sending and receiving heartbeat packets between the client and server, it is possible to determine whether the other party is online. If it is determined that the other party is offline, the transmission of the target file will be terminated in a timely manner, ensuring that normal transmission control commands can be transmitted through the transmission control connection.

[0116] This application embodiment, through a file transfer connection and a transfer control connection, can ensure that both communicating parties can simultaneously and independently transfer files and control file transfer, thus guaranteeing the independence of file transfer and transfer control.

[0117] It should be noted that after the file transfer is completed, the client or server can send a connection disconnect command to the other party to disconnect the file transfer connection and the transfer control connection. Then, when the file transfer is performed again, the file transfer connection and the transfer control connection will be re-established in the manner described in the embodiments of this application. Alternatively, after the file transfer is completed, the file transfer connection and the transfer control connection can be kept open. In this way, if there is a file to be transferred next time, the file transfer connection can be used directly for file transfer, and the transfer control connection can be used for transfer control.

[0118] Figure 3 This is a schematic diagram of the structure of a file transfer control system provided in an embodiment of this application, as shown below. Figure 3 As shown, the file transfer control system 300 includes a client 310 and a server 320.

[0119] Among them, client 310 is used to send connection requests to server 320 in a local area network point-to-point transmission environment;

[0120] Server 320 is used to respond to the connection request and establish a file transfer connection and a transfer control connection with client 310;

[0121] Server 320 is also used to send the target file to client 310 through the file transfer connection;

[0122] Client 310 is also used to receive target files sent by server 320 through the file transfer connection;

[0123] The server 320 is further configured to send a first transmission control instruction for the target file to the client 310 through the transmission control connection, and the client 310 is further configured to perform transmission control on the target file according to the first transmission control instruction; or, the client 310 is further configured to send a second transmission control instruction for the target file to the server 320 through the transmission control connection, and the server 320 is further configured to perform transmission control on the target file according to the second transmission control instruction.

[0124] The server in this file transfer control system is used to execute the file transfer control method applied to the server in the above embodiments, and the client in this file transfer control system is used to execute the file transfer control method applied to the client in the above embodiments. For details, please refer to the above embodiments, which will not be repeated here.

[0125] The file transfer control system provided in this application establishes a file transfer connection and a transfer control connection between the client and the server in a local area network point-to-point transmission environment. The target file is transferred through the file transfer connection, and the transfer control command is transmitted through the transfer control connection. The transfer control can be used to control the transfer of the target file in the file transfer connection based on the transfer control command. The two connections transmit data independently, and the transfer control connection enables the transfer control of the target file in the file transfer connection.

[0126] Figure 4 This is a schematic diagram of a file transfer control device provided in an embodiment of this application. This file transfer control device can be applied to a server in two devices, where the server is used to send files, such as... Figure 4 As shown, the device includes:

[0127] The connection establishment module 410 is used to establish a file transfer connection and a transfer control connection with the client in response to the client's connection request in a local area network point-to-point transmission environment.

[0128] The file sending module 420 is used to send a target file to the client through the file transfer connection;

[0129] The instruction transmission module 430 is configured to send a first transmission control instruction for the target file to the client via the transmission control connection, the first transmission control instruction being used to instruct the client to perform transmission control on the target file; or, to receive a second transmission control instruction for the target file sent by the client via the transmission control connection, and to perform transmission control on the target file according to the second transmission control instruction.

[0130] Optionally, the device further includes:

[0131] The transmission completion message receiving module is used to receive a transmission completion message sent by the client through the transmission control connection after the target file is sent to the client through the file transfer connection. The transmission completion message is used to notify the target file that the transmission has been completed.

[0132] Optionally, the first transmission control command includes an interrupt transmission command, a pause transmission command, a resume transmission command, or a disconnection command;

[0133] The second transmission control command includes an interrupt transmission command, a pause transmission command, a resume transmission command, or a disconnection command.

[0134] Optionally, the connection request includes a first connection request and a second connection request, wherein the first connection request includes a first port number of the server and the second connection request includes a second port number of the server;

[0135] The connection establishment module includes:

[0136] A file transfer connection establishment unit is configured to establish a file transfer connection with the client via the first port number in response to the client's first connection request.

[0137] A control connection establishment unit is used to establish a transmission control connection with the client via the second port number in response to the client's second connection request.

[0138] Optionally, the device further includes:

[0139] The Socket object creation module is used to create a first service Socket object, bind the first service Socket object to the first port number, and create a second service Socket object, binding the second service Socket object to the second port number;

[0140] The information code generation module is used to generate an information code including the IP address of the server, the first port number and the second port number, and display the information code so that the client can identify the information code to obtain the IP address, the first port number and the second port number;

[0141] The connection establishment module is specifically used for:

[0142] In response to the connection request generated by the client recognizing the information code, a file transfer connection and a transfer control connection are established between the client and the client.

[0143] Optionally, the connection establishment module includes:

[0144] The transmission connection establishment unit is used to listen for a first connection request sent by the client, including the first port number, through the first service Socket object, and to establish a file transfer connection between the first service Socket object and the first client Socket object of the client through the first port number;

[0145] The control connection establishment unit is specifically used for:

[0146] The second service Socket object listens for the second connection request sent by the client, which includes the second port number, and establishes a transport control connection between the second service Socket object and the client's second client Socket object through the second port number.

[0147] Optionally, the device further includes:

[0148] The second heartbeat packet sending module is used to send a second heartbeat packet to the client after receiving the first heartbeat packet sent by the client through the transmission control connection during the transmission of the target file through the file transfer connection and after a first preset time.

[0149] The first heartbeat processing module is used to receive the first heartbeat packet sent by the client again through the transmission control connection. The first heartbeat packet received again is sent by the client after the client has received the second heartbeat packet and a first preset time has elapsed; or, if the first heartbeat packet sent by the client is not received again after a second preset time has elapsed after the second heartbeat packet is sent to the client, the sending of the target file to the client is terminated; the second preset time is longer than the first preset time.

[0150] Optionally, the file sending module includes:

[0151] A file transfer message sending unit is configured to send a file transfer message to the client via the file transfer connection, the file transfer message including a waiting transfer flag and file description information of the target file;

[0152] The file sending unit is used to send the target file to the client through the file transfer connection after receiving the consent message sent by the client through the file transfer connection.

[0153] The file transfer control device provided in this application embodiment is used to implement the steps of the file transfer control method applied to the server described in this application embodiment. The specific implementation of each module of the device is described in the corresponding steps, and will not be repeated here.

[0154] The file transfer control device provided in this application establishes a file transfer connection and a transfer control connection with the client in response to the client's connection request in a local area network point-to-point transmission environment. It sends a target file to the client through the file transfer connection and sends a first transfer control instruction for the target file to the client through the transfer control connection, instructing the client to perform transfer control on the received file. Alternatively, it receives a second transfer control instruction for the target file sent by the client through the transfer control connection and performs transfer control on the target file according to the second transfer control instruction. Since the transfer control instruction can be transmitted through the transfer control connection during the transfer of the target file through the file transfer connection, the transfer control of the transmitted file is realized.

[0155] Figure 5This is a schematic diagram of a file transfer control device provided in an embodiment of this application. This file transfer control device can be applied to clients in two devices, where the client is used to receive files, such as... Figure 5 As shown, the device includes:

[0156] The connection request sending module 510 is used to send a connection request to the server in a local area network point-to-point transmission environment. The connection request is used to request the establishment of a file transfer connection and a transmission control connection with the server.

[0157] The file receiving module 520 is used to receive the target file sent by the server through the file transfer connection;

[0158] The instruction transmission module 530 is configured to receive a first transmission control instruction for the target file sent by the server through the transmission control connection, and perform transmission control on the target file according to the first transmission control instruction; or, send a second transmission control instruction for the target file to the server through the transmission control connection, wherein the second transmission control instruction is used to instruct the server to perform transmission control on the target file.

[0159] Optionally, the device further includes:

[0160] The transmission completion message sending module is used to send a transmission completion message to the server through the transmission control connection after receiving the target file sent by the server through the file transfer connection. The transmission completion message is used to notify the server that the target file has been transmitted successfully.

[0161] Optionally, the device further includes:

[0162] The first heartbeat packet sending module is used to send a first heartbeat packet to the server through the transmission control connection during the transmission of the target file through the file transfer connection.

[0163] The second heartbeat processing module is configured to, after receiving the second heartbeat packet sent by the server through the transmission control connection, resend the first heartbeat packet to the server after a first preset time; or, if no second heartbeat packet is received from the server after sending the first heartbeat packet, the module stops sending the first heartbeat packet to the server and stops receiving the target file through the file transfer connection; the second preset time is longer than the first preset time.

[0164] Optionally, the first transmission control command includes an interrupt transmission command, a pause transmission command, a resume transmission command, or a disconnection command;

[0165] The second transmission control command includes an interrupt transmission command, a pause transmission command, a resume transmission command, or a disconnection command.

[0166] Optionally, the connection request includes a first connection request and a second connection request, wherein the first connection request includes a first port number of the server and the second connection request includes a second port number of the server;

[0167] The connection request sending module includes:

[0168] The first request sending unit is configured to send a first connection request to the server, the first connection request being used to request the establishment of a file transfer connection with the server.

[0169] The second request sending unit is used to simultaneously send a second connection request to the server, the second connection request being used to request the establishment of a transmission control connection between the server and the server through the second port number.

[0170] Optionally, the device further includes:

[0171] The server information acquisition module is used to identify the information code displayed by the server and obtain the server's IP address, first port number, and second port number;

[0172] The Socket object creation module is used to create a first client Socket object and a second client Socket object based on the first port number and the second port number.

[0173] The connection request sending module is specifically used for:

[0174] Based on the first client Socket object and the second client Socket object, a connection request is sent to the server corresponding to the IP address.

[0175] Optionally, the connection request sending module includes:

[0176] The first request sending unit is used to send a first connection request, including the first port number, to the server corresponding to the IP address by calling the connection function through the first client Socket object;

[0177] The second request sending unit is used to send a second connection request, including the second port number, to the server corresponding to the IP address by calling the connection function through the second client Socket object.

[0178] Optionally, the file receiving module includes:

[0179] A transmission message receiving unit is configured to receive a file transmission message sent by the server through the file transmission connection, wherein the file transmission message includes a waiting transmission flag and file description information of the target file;

[0180] The display unit is used to display the file description information and receive an acceptance instruction;

[0181] A consent receiving message sending unit is used to send a consent receiving message to the server through the file transfer connection;

[0182] The file receiving unit is used to receive the target file sent by the server through the file transfer connection.

[0183] The file transfer control device provided in this application embodiment is used to implement the steps of the file transfer control method applied to the client described in this application embodiment. The specific implementation of each module of the device is described in the corresponding steps, and will not be repeated here.

[0184] The file transfer control device provided in this application embodiment sends a connection request to the server in a local area network point-to-point transmission environment, and establishes a file transfer connection and a transfer control connection between the server and the server. It receives a target file sent by the server through the file transfer connection, and receives a first transfer control instruction for the target file sent by the server through the transfer control connection, and performs transfer control on the target file received from the file transfer connection. Alternatively, it sends a second transfer control instruction for the target file to the server through the transfer control connection to instruct the server to perform transfer control on the target file. Since the transfer control instruction can be transmitted through the transfer control connection during the transfer of the target file through the file transfer connection, the transfer control of the transmitted file is realized.

[0185] Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application, such as... Figure 6 As shown, the electronic device 600 may include one or more processors 610 and one or more memories 620 connected to the processors 610. The electronic device 600 may also include an input interface 630 and an output interface 640 for communicating with another device or system. Program code executed by the processor 610 may be stored in the memory 620.

[0186] The processor 610 in the electronic device 600 calls the program code stored in the memory 620 to execute the file transfer control method in the above embodiment.

[0187] This application also provides a computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the steps of the file transfer control method as described in this application.

[0188] This application also provides a computer program product that, when executed by a processor, implements the steps of the file transfer control method as described in this application.

[0189] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus embodiments, since they are fundamentally similar to the method embodiments, the description is relatively simple; relevant parts can be referred to the descriptions in the method embodiments.

[0190] The foregoing has provided a detailed description of a file transfer control method, apparatus, electronic device, and storage medium provided in the embodiments of this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of this application. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this application. Therefore, the content of this specification should not be construed as a limitation of this application.

[0191] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

Claims

1. A file transfer control method characterized by, The application comprises the following steps: In a local area network point-to-point transmission environment, a file transmission connection and a transmission control connection are established between the server and the client in response to a connection request from the client; The target file is sent to the client through the file transmission connection; A first transmission control instruction for the target file is sent to the client through the transmission control connection, and the client is instructed to control the transmission of the target file; or a second transmission control instruction for the target file is received from the client through the transmission control connection, and the transmission of the target file is controlled according to the second transmission control instruction.

2. The method of claim 1, wherein, The connection request comprises a first connection request and a second connection request, the first connection request comprises a first port number of the server, and the second connection request comprises a second port number of the server; The server and the client are connected through the first port number in response to the first connection request from the client; The server and the client are connected through the second port number in response to the second connection request from the client. Before the server and the client are connected through the first port number in response to the first connection request from the client, the following steps are further included:

3. The method of claim 2, wherein, A first service Socket object is created, the first service Socket object is bound to the first port number, and a second service Socket object is created, the second service Socket object is bound to the second port number; An information code comprising the IP address of the server, the first port number and the second port number is generated, and the information code is displayed so that the client can identify the information code to obtain the IP address, the first port number and the second port number; The server and the client are connected through the first port number in response to the first connection request from the client; The server and the client are connected through the first port number in response to the first connection request from the client. The server and the client are connected through the first port number in response to the first connection request from the client.

4. The method of claim 3, wherein, The server and the client are connected through the first port number in response to the first connection request from the client. The server and the client are connected through the first port number in response to the first connection request from the client. The server and the client are connected through the first port number in response to the first connection request from the client.

5. The method according to any one of claims 1 to 4, characterized in that, The server and the client are connected through the first port number in response to the first connection request from the client. The server and the client are connected through the first port number in response to the first connection request from the client. In the process of transmitting the target file through the file transmission connection, a second heartbeat packet is sent to the client after a first preset time elapses since the first heartbeat packet sent by the client is received through the transmission control connection; or, the transmission of the target file to the client is ended after a second preset time elapses since the second heartbeat packet is sent to the client and no first heartbeat packet sent by the client again is received. The second preset time is greater than the first preset time. Comprising:

6. A file transfer control method characterized by, In a local area network point-to-point transmission environment, a connection request is sent to a server, the connection request being used to request to establish a file transmission connection and a transmission control connection between the server and the client; Through the file transmission connection, a target file sent by the server is received; Through the transmission control connection, a first transmission control instruction for the target file sent by the server is received, and the target file is controlled according to the first transmission control instruction; or, a second transmission control instruction for the target file is sent to the server through the transmission control connection, the second transmission control instruction being used to instruct the server to control the transmission of the target file. Before the connection request is sent to the server, the following steps are further included:

7. The method of claim 6, wherein, An information code displayed by the server is identified, and an IP address, a first port number and a second port number of the server are obtained; According to the first port number and the second port number, a first client Socket object and a second client Socket object are created; The connection request is sent to the server, including: According to the first client Socket object and the second client Socket object, a connection request is sent to the server corresponding to the IP address. According to the first client Socket object and the second client Socket object, a connection request is sent to the server corresponding to the IP address, including:

8. The method of claim 7, wherein, A connection function is called through the first client Socket object to send a first connection request including the first port number to the server corresponding to the IP address; A connection function is called through the second client Socket object to send a second connection request including the second port number to the server corresponding to the IP address. Through the file transmission connection, the target file sent by the server is received, including:

9. The method according to any one of claims 6-8, characterized in that, Through the file transmission connection, a file transmission message sent by the server is received, the file transmission message including a waiting transmission flag and file description information of the target file; The file description information is displayed, and an agreement receiving instruction is received; Through the file transmission connection, an agreement receiving message is sent to the server; Through the file transmission connection, the target file sent by the server is received. Comprising:

10. A file transfer control system characterized by comprising: A client is used to send a connection request to a server in a local area network point-to-point transmission environment; ​ The server is configured to establish a file transfer connection and a transmission control connection with the client in response to the connection request. The server is further configured to send a target file to the client through the file transfer connection. The client is further configured to receive the target file sent by the server through the file transfer connection. The server is further configured to send a first transmission control instruction for the target file to the client through the transmission control connection, and the client is further configured to perform transmission control on the target file according to the first transmission control instruction; or the client is further configured to send a second transmission control instruction for the target file to the server through the transmission control connection, and the server is further configured to perform transmission control on the target file according to the second transmission control instruction.

11. A file transfer control apparatus characterized by comprising: The application comprises: The connection establishment module is configured to establish a file transfer connection and a transmission control connection with the client in response to a connection request from the client in a local area network point-to-point transmission environment. The file sending module is configured to send a target file to the client through the file transfer connection. The instruction transmission module is configured to send a first transmission control instruction for the target file to the client through the transmission control connection, and the first transmission control instruction is used to instruct the client to perform transmission control on the target file; or the instruction transmission module is configured to receive a second transmission control instruction for the target file sent by the client through the transmission control connection, and perform transmission control on the target file according to the second transmission control instruction.

12. A file transfer control apparatus characterized by comprising: The application comprises: The connection request sending module is configured to send a connection request to a server in a local area network point-to-point transmission environment, and the connection request is used to request establishment of a file transfer connection and a transmission control connection with the server. The file receiving module is configured to receive a target file sent by the server through the file transfer connection. The instruction transmission module is configured to receive a first transmission control instruction for the target file sent by the server through the transmission control connection, and perform transmission control on the target file according to the first transmission control instruction; or the instruction transmission module is configured to send a second transmission control instruction for the target file to the server through the transmission control connection, and the second transmission control instruction is used to instruct the server to perform transmission control on the target file.

13. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, characterized in that, The processor executes the computer program to implement the file transmission control method in any one of claims 1 to 5, or implement the file transmission control method in any one of claims 6 to 9.

14. A computer-readable storage medium having stored thereon a computer program, characterized in that, The program is executed by the processor to implement the steps of the file transmission control method in any one of claims 1 to 5, or implement the steps of the file transmission control method in any one of claims 6 to 9.