Data transmission method and system
By integrating the KCP protocol and the TURN protocol, the transmission speed is dynamically adjusted according to the service type and scenario, the problems of unreliable data transmission and resource waste in the existing technology are solved, and efficient and reliable remote data transmission is achieved.
Patent Information
- Application Number
- CN202310764869.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-06-26
- Publication Date
- 2024-12-27
AI Technical Summary
Existing remote data transmission based on the TURN protocol cannot guarantee the reliability of data transmission, and wastes server bandwidth resources, affecting the efficiency of communication resources.
Combining the KCP protocol and the TURN protocol, the transmission speed is dynamically adjusted according to the service type and scenario through the KCP protocol parameters, ensuring the reliability of data transmission and optimizing the utilization of communication resources.
It improves the efficiency of data transmission and the efficiency of communication resources, and ensures reliable data transmission in different service types and scenarios.
Smart Images

Figure CN119211322A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communications, and more specifically, to a method and system for data transmission. Background Art
[0002] Various terminal devices (such as 1+8+N devices, etc.) on the current market have the need for remote communication (or far-field communication). At present, the traversal using relays around NAT (TURN) protocol can be used as a way of remote data transmission. However, TURN-based data transmission cannot guarantee or support the reliability of data transmission, which affects the efficiency of data transmission. It also wastes the bandwidth resources of the server, increases the consumption of communication resources, and affects the efficiency of the use of communication resources. Summary of the invention
[0003] The present application provides a method and system for data transmission, which integrates the KCP protocol and the TURN protocol. It can support different business types or different business scenarios to use different transmission speeds in the process of data transmission using the TURN protocol, and can guarantee or support reliable data transmission, thereby improving the efficiency of data transmission and the efficiency of communication resource utilization.
[0004] In a first aspect, a system for data transmission is provided, the system comprising: a first terminal device, a TURN server and a second terminal device: the first terminal device and the second terminal device establish a transmission channel based on the TURN protocol, and the transmission channel based on the TURN protocol is a transmission channel that uses the TURN server as a transit; in the transmission channel, the first terminal device sends data to be transmitted to the TURN server based on the KCP protocol and using KCP protocol parameters, and the KCP protocol parameters are determined according to the business type and business scenario corresponding to the data to be transmitted; in the transmission channel, the second terminal device receives the data to be transmitted from the TURN server based on the KCP protocol and using the KCP protocol parameters.
[0005] The data transmission system provided in the first aspect integrates the KCP protocol and the TURN protocol. When the terminal device transmits data remotely, in the transmission channel established based on the TURN protocol, the KCP data packet is transmitted based on the KCP protocol and using the KCP protocol parameters corresponding to the business type and business scenario. Compared with the use of the UDP protocol to transmit data, the business layer does not need to implement reliable transmission itself, thus ensuring reliable data transmission. In addition, the use of KCP protocol parameters corresponding to the business type and business scenario can improve the efficiency of data transmission.
[0006] Exemplarily, the business type information may be an identifier of the business type, and the business scenario information may be an identifier of the business scenario.
[0007] Exemplarily, the first terminal device and the second terminal device may both be 1+8+N devices. For example, the first terminal device or the second terminal device is a home storage device.
[0008] Exemplarily, a first application is installed on the second terminal device, and the first application is related to the service type. That is, the service type is determined according to the application installed on the second terminal device. The service type identifiers (APP IDs) corresponding to different APPs installed on the terminal device are different, or the service type identifiers (APPIDs) corresponding to different products (terminal devices) are different.
[0009] Exemplarily, the data to be transmitted includes at least one of pictures, audio, video, or text information.
[0010] Exemplarily, a software development kit (SDK) is integrated on the devices performing far-field communication (the first terminal device and the second terminal device). The SDK has the following functions: KCP protocol support, TURN protocol support, protocol configuration parameter update, network socket long connection, etc. Far-field communication can be easily realized using one SDK.
[0011] Exemplarily, the SDK may include the following interfaces: gateway connection interface (gatewayConnect), receiving KCP protocol configuration parameter interface (recevieKcpConfig), TURN protocol address allocation interface (turnAllocate), TURN signaling interaction interface (signaturnExchange), KCP protocol parameter configuration interface (config KCP Set), KCP sending interface (ikcp_send), etc.
[0012] In a possible implementation of the first aspect, the values of the KCP protocol parameters corresponding to different service types and / or service scenarios are different. For example, the value of the KCP protocol parameter corresponding to the picture is different from the value of the KCP protocol parameter corresponding to the audio or video.
[0013] In a possible implementation of the first aspect, in the transmission channel, the TURN server receives the data to be transmitted from the first terminal device using a first bandwidth threshold, the first bandwidth threshold is determined according to the service type and service scenario corresponding to the data to be transmitted, and the data to be transmitted includes: service type information and service scenario information corresponding to the data to be transmitted; in the transmission channel, the TURN server sends the data to be transmitted to the second terminal device using the first bandwidth threshold. In this implementation, when receiving and sending the data to be transmitted, the TURN server also uses the TURN protocol transmission bandwidth threshold corresponding to the service type and service scenario, which improves the efficiency of communication resource utilization and ensures the efficiency of data transmission.
[0014] In a possible implementation manner of the first aspect, bandwidth thresholds (first bandwidth thresholds) corresponding to different service types and / or service scenarios are different.
[0015] In a possible implementation of the first aspect, the system further includes: a protocol configuration gateway, and a long connection communication is established between the first terminal device and the second terminal device respectively and the protocol configuration gateway: the protocol configuration gateway receives the business type information and business scenario information corresponding to the data to be transmitted sent by the first terminal device and / or the second terminal device; the protocol configuration gateway determines the first bandwidth threshold and at least one of the KCP protocol parameters according to the business type information and business scenario information corresponding to the data to be transmitted; the protocol configuration gateway sends the first bandwidth threshold and the business type information and business scenario information corresponding to the data to be transmitted to the TURN server, and / or, the protocol configuration gateway sends the KCP protocol parameters to the first terminal device and the second terminal device respectively. In this implementation, the protocol configuration gateway determines the first bandwidth threshold and the KCP protocol parameters according to the business type information and the business scenario information and sends them down. On the one hand, it can ensure that the data transmission and reception speed on the terminal side matches the bandwidth limit of the TURN server on the cloud side, improves the utilization efficiency of communication resources, and ensures the efficiency of data transmission. On the other hand, it is possible to dynamically adjust the transmission speed based on the TURN protocol (i.e., the first bandwidth threshold) and dynamically adjust the KCP protocol parameters for different business types and business scenarios, thereby improving the utilization efficiency of communication resources and ensuring the efficiency of data transmission.
[0016] In a possible implementation of the first aspect, the system further includes: a protocol configuration gateway, and a long connection communication is established between the first terminal device and the second terminal device and the protocol configuration gateway respectively: the first terminal device obtains the public IP address and port number assigned to the first terminal device from the TURN server; the first terminal device sends the public IP address and port number of the first terminal device to the protocol configuration gateway; the second terminal device receives the public IP address and port number of the first terminal device sent by the protocol configuration gateway; the second terminal device obtains the public IP address and port number assigned to the second terminal device from the TURN server; the second terminal device sends the public IP address and port number of the second terminal device to the protocol configuration gateway; the first terminal device receives the public IP address and port number of the second terminal device sent by the protocol configuration gateway. In this implementation, the TURN server assigns a public address and port number to the terminal, and exchanges their respective public IP addresses and port numbers through a long connection with the protocol configuration gateway, without introducing an additional signaling interaction server, which can reduce the number of network elements required by the system and the number of long connections that need to be established, and reduce the complexity of system implementation.
[0017] Exemplarily, the long connection communication may be a Websocket long connection or a secure Websocket long connection, etc.
[0018] In a possible implementation manner of the first aspect, the first terminal device uses the public IP address and port number of the second terminal device to establish the TURN protocol-based transmission channel with the second terminal device.
[0019] In a possible implementation of the first aspect, the KCP protocol parameters include at least one of the following parameters: the value of the maximum transmission unit of the KCP protocol, the value of the receiving window of the KCP protocol, the value of the sending window of the KCP protocol, and indication information of whether the flow control switch is turned on.
[0020] In a second aspect, a method for data transmission is provided, the method comprising: a first terminal device and a second terminal device establish a transmission channel based on a TURN protocol, the transmission channel based on the TURN protocol is a transmission channel that uses a TURN server as a transit; in the transmission channel, the first terminal device sends data to be transmitted to the TURN server based on the KCP protocol and using KCP protocol parameters, and the KCP protocol parameters are determined according to the business type and business scenario corresponding to the data to be transmitted.
[0021] The data transmission method provided in the second aspect integrates the KCP protocol and the TURN protocol. When the terminal device transmits data remotely, it transmits KCP data packets based on the KCP protocol and using KCP protocol parameters corresponding to the business type and business scenario in the transmission channel established based on the TURN protocol. Compared with using the UDP protocol to transmit data, the business layer does not need to implement reliable transmission itself, thus ensuring reliable data transmission. In addition, using KCP protocol parameters corresponding to the business type and business scenario can improve the efficiency of data transmission.
[0022] Exemplarily, the business type information may be an identifier of the business type, and the business scenario information may be an identifier of the business scenario.
[0023] Exemplarily, the first terminal device is a 1+8+N device. For example, the first terminal device is a home storage device.
[0024] Exemplarily, a first application is installed on the second terminal device, and the first application is related to the service type. That is, the service type is determined according to the application installed on the second terminal device. The service type identifiers (APP IDs) corresponding to different APPs installed on the terminal device are different, or the service type identifiers (APPIDs) corresponding to different products (terminal devices) are different.
[0025] Exemplarily, the data to be transmitted includes at least one of pictures, audio, video, or text information.
[0026] Exemplarily, the first terminal device integrates an SDK, and the SDK has the following functions: KCP protocol support, TURN protocol support, protocol configuration parameter update, network socket long connection, etc., and far-field communication can be easily realized using one SDK.
[0027] Exemplarily, the SDK may include the following interfaces: gateway connection interface (gatewayConnect), receiving KCP protocol configuration parameter interface (recevieKcpConfig), TURN protocol address allocation interface (turnAllocate), TURN signaling interaction interface (signaturnExchange), KCP protocol parameter configuration interface (config KCP Set), KCP sending interface (ikcp_send), etc.
[0028] In a possible implementation of the second aspect, the values of the KCP protocol parameters corresponding to different service types and / or service scenarios are different. For example, the value of the KCP protocol parameter corresponding to the picture is different from the value of the KCP protocol parameter corresponding to the audio or video.
[0029] In a possible implementation of the second aspect, the method further includes: the first terminal device sends the service type information and service scenario information corresponding to the data to be transmitted to the protocol configuration gateway, and the first terminal device and the protocol configuration gateway establish a long connection communication; the first terminal device receives the KCP protocol parameters sent by the protocol configuration gateway. In this implementation, the protocol configuration gateway determines and issues the KCP protocol parameters based on the service type information and service scenario information, and can dynamically adjust the KCP protocol parameters for different service types and service scenarios, thereby improving the efficiency of communication resource utilization and ensuring the efficiency of data transmission.
[0030] In a possible implementation of the second aspect, the method further includes: the first terminal device obtains the public IP address and port number assigned to the first terminal device from the TURN server; the first terminal device sends the public IP address and port number of the first terminal device to the protocol configuration gateway, and the first terminal device and the protocol configuration gateway establish a long connection communication; the first terminal device receives the public IP address and port number of the second terminal device sent by the protocol configuration gateway. In this implementation, the TURN server assigns a public address and port number to the terminal, and exchanges the respective public IP addresses and port numbers through the long connection with the protocol configuration gateway, which can quickly and conveniently realize the exchange of public IP addresses and port numbers, thereby improving communication efficiency.
[0031] Exemplarily, the long connection communication may be a Websocket long connection or a secure Websocket long connection, etc.
[0032] In a possible implementation of the second aspect, the first terminal device and the second terminal device establish a transmission channel based on the TURN protocol, including: the first terminal device uses the public IP address and port number of the second terminal device to establish the transmission channel based on the TURN protocol with the second terminal device.
[0033] Exemplarily, the KCP protocol parameters include at least one of the following parameters:
[0034] The value of the maximum transmission unit of the KCP protocol, the value of the receiving window of the KCP protocol, the value of the sending window of the KCP protocol, and the indication information of whether the flow control switch is turned on.
[0035] According to a third aspect, a method for data transmission is provided, the method comprising: a second terminal device and a first terminal device establish a transmission channel based on a TURN protocol, wherein the transmission channel based on the TURN protocol is a transmission channel that uses a TURN server as a transit; in the transmission channel, the second terminal device receives data to be transmitted from the TURN server based on the KCP protocol and using KCP protocol parameters, wherein the KCP protocol parameters are determined according to a service type and a service scenario corresponding to the data to be transmitted.
[0036] The data transmission system provided in the third aspect integrates the KCP protocol and the TURN protocol. When the terminal device transmits data remotely, it transmits KCP data packets based on the KCP protocol in the transmission channel established based on the TURN protocol, using the KCP protocol parameters corresponding to the business type and business scenario. Compared with using the UDP protocol to transmit data, the business layer does not need to implement reliable transmission itself, thus ensuring reliable data transmission. In addition, the use of KCP protocol parameters corresponding to the business type and business scenario can improve the efficiency of data transmission.
[0037] Exemplarily, the business type information may be an identifier of the business type, and the business scenario information may be an identifier of the business scenario.
[0038] Exemplarily, the first terminal device is a 1+8+N device. For example, the first terminal device is a home storage device.
[0039] Exemplarily, a first application is installed on the second terminal device, and the first application is related to the service type. That is, the service type is determined according to the application installed on the second terminal device. The service type identifiers (APP IDs) corresponding to different APPs installed on the terminal device are different, or the service type identifiers (APPIDs) corresponding to different products (terminal devices) are different.
[0040] Exemplarily, the data to be transmitted includes at least one of pictures, audio, video, or text information.
[0041] Exemplarily, the first terminal device integrates an SDK, and the SDK has the following functions: KCP protocol support, TURN protocol support, protocol configuration parameter update, network socket long connection, etc., and far-field communication can be easily realized using one SDK.
[0042] Exemplarily, the SDK may include the following interfaces: gateway connection interface (gatewayConnect), receiving KCP protocol configuration parameter interface (recevieKcpConfig), TURN protocol address allocation interface (turnAllocate), TURN signaling interaction interface (signaturnExchange), KCP protocol parameter configuration interface (config KCP Set), KCP sending interface (ikcp_send), etc.
[0043] In a possible implementation of the third aspect, the values of the KCP protocol parameters corresponding to different service types and / or service scenarios are different. For example, the value of the KCP protocol parameter corresponding to a picture is different from the value of the KCP protocol parameter corresponding to audio or video.
[0044] In a possible implementation of the third aspect, the method also includes: the second terminal device sends business type information and business scenario information corresponding to the data to be transmitted to the protocol configuration gateway, and a long connection communication is established between the second terminal device and the protocol configuration gateway; the second terminal device receives the KCP protocol parameters sent by the protocol configuration gateway.
[0045] In a possible implementation of the third aspect, the method also includes: the second terminal device obtains the public IP address and port number allocated to the first terminal device from the TURN server; the second terminal device sends the public IP address and port number of the second terminal device to the protocol configuration gateway, and a long connection communication is established between the second terminal device and the protocol configuration gateway; the second terminal device receives the public IP address and port number of the first terminal device sent by the protocol configuration gateway.
[0046] In a possible implementation of the third aspect, the second terminal device and the first terminal device establish a transmission channel based on the TURN protocol, including: the second terminal device uses the public IP address and port number of the first terminal device to establish the transmission channel based on the TURN protocol with the first terminal device.
[0047] In a possible implementation manner of the third aspect, the KCP protocol parameter includes at least one of the following parameters:
[0048] The value of the maximum transmission unit of the KCP protocol, the value of the receiving window of the KCP protocol, the value of the sending window of the KCP protocol, and the indication information of whether the flow control switch is turned on.
[0049] Among them, the beneficial effects of various possible implementation methods of the third aspect can refer to the description of the beneficial effects of various possible implementation methods corresponding to the above-mentioned second aspect.
[0050] In a fourth aspect, a method for data transmission is provided, the method comprising: a TURN server respectively establishes a transmission channel with a first terminal device and a second terminal device based on a TURN protocol, the transmission channel based on the TURN protocol is a transmission channel that uses the TURN server as a transit; in the transmission channel, the TURN server uses a first bandwidth threshold to receive data to be transmitted sent by the first terminal device based on a KCP protocol, the first bandwidth threshold is determined according to a service type and a service scenario corresponding to the data to be transmitted, and the data to be transmitted includes: service type information and service scenario information corresponding to the data to be transmitted; in the transmission channel, the TURN server uses the first bandwidth threshold to send the data to be transmitted to the second terminal device based on the KCP protocol.
[0051] The fourth aspect provides a method for data transmission. When the TURN server receives and sends data to be transmitted, it integrates the KCP protocol and the TURN protocol. In the transmission channel established based on the TURN protocol, the KCP data packet is transmitted based on the KCP protocol using the first bandwidth threshold corresponding to the business type and business scenario. Compared with using the UDP protocol to transmit data, the business layer does not need to implement reliable transmission itself, thereby ensuring reliable data transmission. In addition, the TURN protocol transmission bandwidth threshold (first bandwidth threshold) corresponding to the business type and business scenario is used to improve the efficiency of communication resource utilization and ensure the efficiency of data transmission.
[0052] Exemplarily, the business type information may be an identifier of the business type, and the business scenario information may be an identifier of the business scenario.
[0053] Exemplarily, a first application is installed on the second terminal device, and the first application is related to the service type. That is, the service type is determined according to the application installed on the second terminal device. The service type identifiers (APP IDs) corresponding to different APPs installed on the terminal device are different, or the service type identifiers (APPIDs) corresponding to different products (terminal devices) are different.
[0054] In a possible implementation of the fourth aspect, different business types and / or business scenarios correspond to Figure 1 The bandwidth thresholds are different.
[0055] In a possible implementation of the fourth aspect, the method further includes: the TURN server receives the first bandwidth threshold sent by the protocol configuration gateway and the service type information and service scenario information corresponding to the data to be transmitted. In this implementation, the transmission speed (i.e., the first bandwidth threshold) based on the TURN protocol can be dynamically adjusted for different service types and service scenarios, thereby improving the utilization efficiency of communication resources and ensuring the efficiency of data transmission.
[0056] In a fifth aspect, a method for data transmission is provided, the method comprising: a protocol configuration gateway receives business type information and business scenario information corresponding to the data to be transmitted sent by the first terminal device and / or the second terminal device, and a long connection communication is established between the first terminal device and the second terminal device and the protocol configuration gateway; the protocol configuration gateway determines a first bandwidth threshold and at least one of the KCP protocol parameters based on the business type information and business scenario information corresponding to the data to be transmitted; the protocol configuration gateway sends the first bandwidth threshold and the business type information and business scenario information corresponding to the data to be transmitted to the TURN server, and / or the protocol configuration gateway sends the KCP protocol parameters to the first terminal device and the second terminal device respectively.
[0057] Exemplarily, the KCP protocol parameters include at least one of the following parameters:
[0058] The value of the maximum transmission unit of the KCP protocol, the value of the receiving window of the KCP protocol, the value of the sending window of the KCP protocol, and the indication information of whether the flow control switch is turned on.
[0059] The fifth aspect provides a method for data transmission, in which the protocol configuration gateway determines and issues the first bandwidth threshold and KCP protocol parameters based on the business type information and business scenario information. On the one hand, it can ensure that the data transmission and reception speed on the terminal device side matches the bandwidth limit of the TURN server on the cloud side, thereby improving the efficiency of communication resource utilization and ensuring the efficiency of data transmission. On the other hand, it can dynamically adjust the transmission speed (i.e., the first bandwidth threshold) based on the TURN protocol for different business types and business scenarios, as well as dynamically adjust the KCP protocol parameters, thereby improving the efficiency of communication resource utilization and ensuring the efficiency of data transmission.
[0060] In a possible implementation of the fifth aspect, the method further includes: the protocol configuration gateway receives the public IP address and port number of the first terminal device sent by the first terminal device; the protocol configuration gateway receives the public IP address and port number of the first terminal device sent by the second terminal device; the protocol configuration gateway sends the public IP address and port number of the second terminal device to the first terminal device; the protocol configuration gateway sends the public IP address and port number of the first terminal device to the second terminal device. In this implementation, the public IP address and port number of the terminal device are exchanged through the long connection between the protocol configuration gateway and the terminal device, so that the exchange of the public IP address and port number can be realized quickly and conveniently, thereby improving communication efficiency.
[0061] Exemplarily, the long connection communication may be a Websocket long connection or a secure Websocket long connection, etc.
[0062] In a sixth aspect, a communication device is provided, comprising: a unit for executing each step in any one of the second and third aspects above, or any possible implementation method of any one of the second and third aspects.
[0063] In the seventh aspect, a communication device is provided, which includes at least one processor and a memory, the processor and the memory are coupled, the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the method of any one of the second and third aspects above, or any possible implementation of any one of the second and third aspects is performed.
[0064] In an eighth aspect, a communication device is provided, which includes at least one processor and an interface circuit, and the at least one processor is used to execute: a method of any one of the second and third aspects above, or a method in any possible implementation manner of any one of the second and third aspects.
[0065] In the ninth aspect, a terminal device is provided, which includes any communication device provided in the sixth aspect, the seventh aspect or the eighth aspect.
[0066] Exemplarily, the terminal device may be: a home storage device.
[0067] In the tenth aspect, a communication device is provided, which includes at least one processor and a memory, the processor and the memory are coupled, the memory stores program instructions, and when the program instructions stored in the memory are executed by the processor, the method of any one of the fourth and fifth aspects above, or any possible implementation of any one of the fourth and fifth aspects is performed.
[0068] In an eleventh aspect, a communication device is provided, which includes: a unit for executing each step in any one of the fourth and fifth aspects above, or any possible implementation method of any one of the fourth and fifth aspects.
[0069] In the twelfth aspect, a communication device is provided, which includes at least one processor and an interface circuit, and the at least one processor is used to execute: the method of any aspect of the fourth and fifth aspects above, or the method of any possible implementation of any aspect of the fourth and fifth aspects.
[0070] In the thirteenth aspect, a server is provided, comprising any communication device provided in the tenth aspect, eleventh aspect or twelfth aspect.
[0071] Exemplarily, the server may be: a protocol configuration gateway or a TURN server.
[0072] In the fourteenth aspect, a computer program product is provided, which includes a computer program, which, when executed by a processor, is used to execute the method in the second aspect or any possible implementation of the second aspect, or to execute the method in the third aspect or any possible implementation of the third aspect, or to execute the method in the fourth aspect or any possible implementation of the fourth aspect, or to execute the method in the fifth aspect or any possible implementation of the fifth aspect.
[0073] In the fifteenth aspect, a computer-readable storage medium is provided, which stores a computer program. When the computer program is executed, it is used to execute the method in the second aspect or any possible implementation of the second aspect, or to execute the method in the third aspect or any possible implementation of the third aspect, or to execute the method in the fourth aspect or any possible implementation of the fourth aspect, or to execute the method in the fifth aspect or any possible implementation of the fifth aspect.
[0074] In the sixteenth aspect, a chip is provided, comprising: a processor, for calling and running a computer program from a memory, so that a communication device equipped with the chip executes the method in the second aspect or any possible implementation of the second aspect, or executes the method in the third aspect or any possible implementation of the third aspect, or is used to execute the method in the fourth aspect or any possible implementation of the fourth aspect, or is used to execute the method in the fifth aspect or any possible implementation of the fifth aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0075] Figure 1 This is a system architecture diagram showing data transmission between two terminal devices based on the TURN protocol.
[0076] Figure 2 It is a schematic diagram of a communication scenario provided in an embodiment of the present application.
[0077] Figure 3 It is a schematic diagram of a communication system provided in an embodiment of the present application.
[0078] Figure 4 This is a schematic flowchart of an example of a data transmission method provided in this application.
[0079] Figure 5 This is a flowchart of an example of a method for data transmission in a communication system provided in the present application.
[0080] Figure 6 This is a schematic interface diagram provided by the present application for triggering a mobile phone and a home storage device to establish a Websocket long connection with a protocol configuration gateway respectively.
[0081] Figure 7 This is another example provided by the present application of triggering a mobile phone and a home storage device to establish a Websocket long connection with a protocol configuration gateway respectively.
[0082] Figure 8 This is another example provided by the present application, and is a flowchart of a method for data transmission in a communication system provided by the present application.
[0083] Fig. 9 This is a schematic diagram of an example of triggering the data transmission process between a mobile phone and a home storage device provided by the present application.
[0084] Fig.10 It is a schematic block diagram of a communication device provided in an embodiment of the present application.
[0085] Fig.11 It is a schematic block diagram of a communication device provided in an embodiment of the present application.
[0086] Fig.12 It is a schematic block diagram of a communication device provided in an embodiment of the present application.
[0087] Fig.13 It is a schematic block diagram of a communication device provided in an embodiment of the present application.
[0088] Fig.14 It is a schematic block diagram of a chip system provided in an embodiment of the present application. DETAILED DESCRIPTION
[0089] The technical solution in this application will be described below in conjunction with the accompanying drawings.
[0090] In the description of the embodiments of the present application, unless otherwise specified, " / " means or, for example, A / B can mean A or B; "and / or" in this article is only a description of the association relationship of associated objects, indicating that there can be three relationships, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, "multiple" means two or more than two.
[0091] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this embodiment, unless otherwise specified, "plurality" means two or more.
[0092] In addition, various aspects or features of the present application can be implemented as methods, devices or products using standard programming and / or engineering techniques. The term "product" used in this application covers computer programs that can be accessed from any computer-readable device, carrier or medium. For example, computer-readable media may include, but are not limited to: magnetic storage devices (e.g., hard disks, floppy disks or tapes, etc.), optical disks (e.g., compact discs (CDs), digital versatile discs (DVDs), etc.), smart cards and flash memory devices (e.g., erasable programmable read-only memory (EPROM), cards, sticks or key drives, etc.). In addition, the various storage media described herein may represent one or more devices and / or other machine-readable media for storing information. The term "machine-readable medium" may include, but is not limited to, wireless channels and various other media capable of storing, containing and / or carrying instructions and / or data.
[0093] Various terminal devices currently on the market (such as 1+8+N devices, etc.) already have the ability of near-field communication. Near-field communication can be carried out when the terminal devices of the communicating parties are in the same local area network or close to each other. Typical near-field communication scenarios include one-touch transmission, multi-screen collaboration and other capabilities. In addition to near-field communication, there is also a need for remote communication (or far-field communication) between various terminal devices. For example, remote file sharing between mobile phones and tablets, smart screens, remote audio and video transmission between mobile phones and car computers, file transfer (file storage) between mobile phones and home storage devices, etc., all have remote communication scenarios. Remote transmission scenarios include, for example, file transfer, audio and video transmission, signaling or message transmission, etc.
[0094] Currently, many products including Huawei home storage, routers, and Changlian use the TURN protocol as a method of remote data transmission.
[0095] For example, Figure 1 The figure shows an example of a system architecture diagram for data transmission between two terminal devices based on the TURN protocol. The TURN protocol is based on the user datagram protocol (UDP) when sending data. Figure 1As shown, the system includes: a first terminal device that sends data, a second terminal device that receives data, a signaling server, a first TURN relay server that communicates with the first terminal device, and a second TURN relay server that communicates with the second terminal device.
[0096] exist Figure 1 In the example shown, a software development kit (SDK) is integrated on both the first terminal device and the second terminal device, and the SDK has the function of supporting the TURN protocol. After the first terminal device calls the SDK to connect to the first TURN relay server, it can obtain the public Internet protocol (IP) address and port number (port) assigned by the first TURN relay server to the first terminal device. After the second terminal device calls the SDK to connect to the second TURN relay server, it can also obtain the public IP address and port number (port) assigned by the second TURN relay server to the second terminal device. In addition, the bandwidth (or transmission speed) threshold used by the first TURN relay server and the second TURN relay server in the process of data transmission (forwarding) are both globally unified bandwidth thresholds, that is, regardless of the type of service or the type of service scenario, the bandwidth (or transmission speed) threshold is the same (for example, 30Mbps).
[0097] After the first terminal device and the second terminal device respectively obtain the public IP address and port number (port) assigned by the TURN relay server, the first terminal device and the second terminal device can exchange their respective public IP addresses and port numbers through the signaling server. After exchanging their respective public IP addresses and port numbers, the first terminal device can use the TURN protocol to transmit the data to be transmitted to the second terminal device through the first TURN relay server and the second TURN relay server, thereby realizing remote data transmission using the TURN protocol. In addition, the TURN protocol itself is based on UDP, that is, the entire data transmission process is based on the UDP protocol.
[0098] exist Figure 1 In the example shown;
[0099] On the one hand, the protocol server supporting TURN (i.e., TURN relay server) only supports one global bandwidth threshold configuration. All business types or business scenarios use the same bandwidth threshold configuration, and different bandwidth limits cannot be used according to different business types or business scenarios. However, different business types or business scenarios have different bandwidth requirements for TURN servers. For example, when transmitting videos in a home storage scenario, the bandwidth of the TURN server needs to be above 30Mbps. For services such as users accessing servers through routers, the bandwidth requirement for the TURN server is only about 5Mbps. In different business types or business scenarios, if the bandwidth threshold is too small, it will cause packet loss on the server side, and the client device needs to retransmit continuously, wasting the user's uplink bandwidth. If the bandwidth threshold is configured too large, the server's bandwidth resources will be wasted, that is, the consumption of communication resources will be increased, affecting the efficiency of communication resource use.
[0100] On the other hand, the TURN protocol itself is based on UDP when sending data. When the client transmits data through the TURN server, different business types or business scenarios need to implement their own reliable transmission logic, that is, the business itself needs to perform reliable transmission at the business layer, resulting in the inability to guarantee or support the reliability of data transmission, affecting the efficiency of data transmission.
[0101] Therefore, a technical solution is needed that can ensure that in the process of data transmission using the TURN protocol, different business types or different transmission speeds are supported for different business scenarios, and that reliable data transmission can be guaranteed or supported, thereby improving the efficiency of data transmission and the efficiency of communication resource utilization.
[0102] In view of this, the present application provides a method and system for data transmission, which includes: multiple terminal devices for data transmission (for example, 1+8+N devices), a protocol configuration gateway, and one or more TURN servers. SDKs are integrated on the terminal devices for data transmission, and the SDKs have the following functions: KCP protocol support, TURN protocol support, protocol configuration parameter updates, network socket long connections, etc. Data transmission between devices can be easily realized using one SDK. The protocol configuration gateway can configure the transmission speed based on the KCP protocol and the transmission speed based on the TURN protocol corresponding to the business type and business scenario according to different business types and business scenarios, and send them to the two devices of the data transmission and the TURN server respectively, so as to realize the dynamic adjustment of the transmission speed of the KCP protocol and the TURN protocol, improve the utilization efficiency of communication resources, and ensure the efficiency of data transmission. The KCP protocol and the TURN protocol are integrated, and the two devices of the data transmission are based on the TURN protocol, and the public network address and port based on the TURN protocol are used to establish a transmission channel based on the TURN protocol. When users transmit data remotely, in the transmission channel based on the TURN protocol, KCP packets are transmitted based on the KCP protocol and using the KCP protocol transmission speed corresponding to the service type and service scenario. Compared with using the UDP protocol to transmit data, the service layer does not need to implement reliable transmission itself, which ensures reliable data transmission and improves the efficiency of data transmission. In the process of forwarding data, the TURN server uses the TURN protocol transmission speed (such as bandwidth threshold) corresponding to the service type and service scenario to forward data, ensuring that the data transmission and reception speed on the end side matches the bandwidth limit of the TURN server on the cloud side, improving the efficiency of communication resource utilization and ensuring the efficiency of data transmission.
[0103] First, briefly introduce the KCP protocol;
[0104] KCP is a fast and reliable protocol that can reduce the average delay by 30%-40% at the cost of wasting 10%-20% of the bandwidth relative to the transmission control protocol (TCP), and can achieve a transmission effect with a maximum delay three times lower than that of TCP transmission. The characteristic of TCP transmission is that it can realize reliable transmission of data, while KCP can be realized through pure algorithms and is not responsible for the underlying protocol, that is, KCP can be understood as an application layer protocol, and the user needs to define the sending and receiving methods of the underlying data (i.e., the underlying protocol). The KCP underlying protocol can be UDP or TCP, and in the embodiment of the present application, since the TURN protocol is based on the UDP protocol, the KCP underlying protocol is also the UDP protocol, that is, KCP is used on the UDP protocol to ensure reliable transmission. In other words, the sending and receiving methods of the underlying data are based on the UDP protocol, and the KCP protocol is used to ensure reliable data transmission.
[0105] refer to Figure 2 , Figure 2 The figure shows a schematic diagram of a communication scenario applicable to an embodiment of the present application. Figure 2 As shown, the technical solution provided by the present application can be applied to scenarios where mobile phones, tablets, personal computers (PCs), home storage devices, large-screen devices and other devices communicate with each other, and can include different business scenarios such as remote file transfer, audio and video transmission, signaling or message transmission between any two devices. For example, remote file sharing between mobile phones, tablets, home storage devices, etc., remote file storage or retrieval between mobile phones and home storage devices, etc. Users can conduct remote communication between any two devices anytime and anywhere.
[0106] First, the communication system provided by this application is introduced.
[0107] Figure 3 The diagram shown is a schematic diagram of an example communication system provided by the present application, such as Figure 3 As shown, the communication system includes: multiple terminal devices for communication (for example, mobile phones, tablets, large-screen devices, PCs, etc.), a TURN server (the TURN server may also be called a TURN relay server) and a protocol configuration gateway.
[0108] Among them, each terminal device for communication is integrated with a software development kit (SDK), which has the following functions: KCP protocol support, TURN protocol support, protocol configuration parameter update, network socket (Websocket, WS) long connection, etc., and one SDK can be used to easily realize far-field communication. For example, for the update function of the protocol configuration parameters, the terminal device can receive the configuration of the KCP protocol parameters sent by the protocol configuration gateway, and use the KCP protocol parameters to update or change the original KCP protocol parameters; for the KCP protocol support function, the terminal device can use the updated or changed KCP protocol parameters based on the KCP protocol to transmit data between the TURN server. For the functions supported by the TURN protocol, the terminal device can obtain the public IP address and port number assigned to the terminal device from the TURN server, and use the public IP address and port number to transmit data with the peer device, that is, establish a communication process based on the TURN protocol with the peer device; for the function of long-term connection of network sockets (Websocket), the terminal device can establish a long-term connection of network sockets (Websocket) with the protocol configuration gateway, so as to maintain a long-term communication connection with the protocol configuration gateway (that is, the communication connection is always maintained). Various applications on the terminal device (including system applications and third-party applications, etc.) can use SDK and other devices to complete remote data transmission.
[0109] exist Figure 3 In the communication system shown, the TURN server has: support for the TURN protocol and configuration and update of the TURN protocol parameters. For example, the TURN server can allocate public network IP addresses and port numbers to the terminal devices that communicate with each other, so that the terminal devices that communicate with each other can transmit data through the relay of the TURN server and the TURN protocol. In addition, the TURN server can receive the TURN protocol parameter configuration (such as bandwidth threshold) sent by the protocol configuration gateway, use the TURN protocol parameters to update or change the original TURN protocol parameters, and use the TURN protocol parameters to receive and send data.
[0110] exist Figure 3In the communication system shown, the protocol configuration gateway supports the establishment of a long Websocket connection with the terminal device, and supports the configuration and delivery of TURN protocol parameters, as well as the configuration and delivery of KCP protocol parameters. For example, the protocol configuration gateway can configure different TURN protocol parameters (such as bandwidth thresholds, etc.) according to different business types and business scenarios and send them to the TURN server; according to different business types and business scenarios, configure different KCP protocol parameters and send them to the terminal device. In addition, the protocol configuration gateway can also support signaling interaction functions, and the terminal devices that communicate with each other can exchange their respective public network IP addresses and port numbers through the protocol configuration gateway.
[0111] exist Figure 3 In the communication system shown, there may be a communication connection between the terminal device and the protocol configuration gateway, there may also be a communication connection between the terminal device and the TURN server, and there may also be a communication connection between the protocol configuration gateway and the TURN server. Thus, the terminal device uses the SDK to realize the transmission of signaling and data between the protocol configuration gateway and the TURN server, and the transmission of TURN protocol parameters between the protocol configuration gateway and the TURN server.
[0112] In the embodiments of the present application, the communication terminal devices may include: mobile phones, home storage devices, tablet computers, laptop computers, ultra-mobile personal computers (UMPCs), handheld computers, netbooks, personal digital assistants (PDAs), wearable electronic devices, virtual reality devices, and other IOT (internet of things) devices, etc., and the embodiments of the present application are not limited here.
[0113] exist Figure 3In the communication system shown, the various devices of the communication system (e.g., between the terminal device and the protocol configuration gateway, between the terminal device and the TURN server, etc.) can be interconnected through a communication network. Exemplarily, the communication network can be a wired network or a wireless network. For example, the communication network can be a local area network (LAN) or a wide area network (WAN), such as the Internet. The above-mentioned communication network can be implemented using any known network communication protocol, and the above-mentioned network communication protocol can be various wired or wireless communication protocols, such as Ethernet, universal serial bus (USB), FIREWIRE, global system for mobile communications (GSM), general packet radio service (GPRS), code division multiple access (CDMA), wideband code division multiple access (WCDMA), time-division code division multiple access (TD-SCDMA), long term evolution (LTE), Bluetooth, wireless fidelity (Wi-Fi), NFC, voice over Internet protocol (VoIP), communication protocols supporting network slicing architecture or any other suitable communication protocols.
[0114] That is to say, each device in the communication system can form a network (ie, networking) according to certain communication protocols and networking strategies, so that each device in the system can communicate with each other.
[0115] For example, in Figure 3 In the communication system shown, the protocol configuration gateway and the TURN server can be deployed on the cloud side.
[0116] It should be understood that Figure 3 The communication system shown is merely exemplary and should not impose any limitation on the communication system to which the embodiments of the present application are applicable. For example, in other embodiments of the present application, the communication system may further include more terminal devices, or may further include more TURN servers, etc. The embodiments of the present application are not limited here.
[0117] It should also be understood that in the embodiment of the present application, the Websocket persistent connection can also be replaced by a secure Websocket persistent connection (websocket secure, WSS). In other words, the terminal device can also establish a WSS-based persistent connection with the protocol configuration gateway.
[0118] The following will illustrate the data transmission method provided by the present application with reference to specific examples. For example, the data transmission method provided by the present application can be applied to Figure 3 Of course, the data transmission method provided in the present application can also be applied in other communication systems, and the embodiments of the present application are not limited here.
[0119] Assumption: Terminal device A needs to send a file to terminal device B. Terminal device A is a mobile phone, and terminal device B is a home storage device, that is, the mobile phone needs to store the file in the home storage device. The application identity (APP ID) corresponding to the home storage device is "001". The APP ID is used to identify the service type. Different services or different APPs installed on the terminal device correspond to different APP IDs, or different products (terminal devices) correspond to different APP IDs. In other words, the application installed on the receiving device (such as a home storage device) is related to the service type. For example, the service type may include: home storage, Changlian, mobile phone voice compensation, gallery, smart life, instant messaging service, etc. Different service types correspond to different APP IDs. The APP type (APP type) of data transmission is "file", that is, a file transfer scenario or a large file transfer scenario. APP type is used to identify the service scenario corresponding to a data transmission. For example, the service scenario may include: file transfer, video transmission scenario, audio transmission scenario, signaling message sending and receiving scenario, etc. Different service scenarios correspond to different APP types.
[0120] Of course, in other implementations of the present application, the data sent by the mobile phone to the home storage device may also include: one or more of pictures, audio, video or application programs, etc. The present application embodiment does not limit the specific business scenario corresponding to the data to be transmitted.
[0121] For example, Table 1 is a schematic table of business types and business scenarios.
[0122] Table 1 Business types and business scenarios
[0123]
[0124] It should be understood that Table 1 is merely exemplary and should not impose any limitation on the service types and service scenarios in the embodiments of the present application. In other implementations of the present application, the service types and / or service scenarios may include other types, such as picture transmission, text information transmission, etc. Alternatively, the above service types and / or service scenarios may be named as other names, etc. The embodiments of the present application are not limited here.
[0125] First, the terminal devices (such as mobile phones and home storage devices) that perform communication need to integrate SDK. In the embodiment of the present application, SDK is cross-operating system, for example, support Harmony, Or other operating systems. For example, the SDK supports at least the following four capabilities:
[0126] First: SDK supports KCP protocol.
[0127] Terminal devices that have integrated the SDK (such as mobile phones and home storage devices) can transmit data between TURN servers based on the KCP protocol using updated or changed KCP protocol parameters.
[0128] Exemplarily, Table 2 shows an example description of the KCP protocol parameters involved in the embodiments of the present application.
[0129] Table 2 KCP protocol parameters
[0130]
[0131] It should be understood that Table 2 is merely exemplary and should not impose any restrictions on the KCP protocol parameters in the embodiments of the present application. In other implementations of the present application, the KCP protocol parameters may also include more parameters, or the above parameters may also be named by other names, etc. For example, the size of the MTU of the KCP protocol may also be referred to as: the value of the maximum transmission unit of the KCP protocol; the size of the receiving window of the KCP protocol may also be referred to as: the value of the receiving window of the KCP protocol; the flow control switch of the KCP protocol may also be referred to as: the indication information of whether the flow control switch is turned on, etc. The embodiments of the present application are not limited here.
[0132] Second: SDK supports TURN protocol.
[0133] The TURN protocol provides relay capabilities. Devices that have integrated the SDK (such as mobile phones and home storage devices) can connect to the TURN server, obtain the public IP address and port number assigned to the terminal device from the TURN server, and use the public IP address and port number to achieve remote data transmission with the peer device through the relay of the TURN server.
[0134] Third: SDK supports websocket long connection.
[0135] Devices that have integrated the SDK (such as mobile phones and home storage devices) can establish a websocket persistent connection with the protocol configuration gateway, so that signaling interaction can be carried out with the protocol configuration gateway. For example, KCP protocol parameters can be obtained, and public IP addresses and ports can be exchanged through websocket persistent connections.
[0136] Fourth: SDK supports updating of protocol configuration parameters.
[0137] Terminal devices integrated with SDK can receive relevant parameter configurations of the KCP protocol sent by the protocol configuration gateway, and apply these parameters for data transmission when sending data using the KCP protocol.
[0138] For example, in an embodiment of the present application, the SDK may support the interfaces shown in Table 3.
[0139] Table 3 SDK supported interfaces
[0140]
[0141]
[0142] It should be understood that Table 3 is merely exemplary and should not impose any restrictions on the interfaces supported by the SDK in the embodiment of the present application. In other implementations of the present application, the communication SDK may also support more interfaces, or the above interfaces may also be named other names, etc. The embodiment of the present application is not limited here.
[0143] For example, the SDK integrated on both mobile phones and home storage devices can support: gateway connection interface (gatewayConnect), receiving KCP protocol configuration parameter interface (recevieKcpConfig), TURN protocol address allocation interface (turnAllocate), TURN signaling interaction interface (signaturnExchange), KCP protocol parameter configuration interface (config KCP Set), KCP sending interface (ikcp_send), etc.
[0144] Combine the following Figures 4 to 9 A method of data transmission is provided, wherein: Figure 4 What is shown is a schematic flow chart of the data transmission method provided by the present application in the above scenario. Figure 5 and Figure 8 The figure is a flow chart of a method for data transmission in a communication system provided in the present application. Figure 5The steps in the process mainly include step 1 to step 4. Figure 8 The steps shown mainly include step five and step six.
[0145] like Figure 4 As shown, the method 400 includes:
[0146] S410, the mobile phone and the home storage device respectively establish a Websocket persistent connection with the protocol configuration gateway. After the Websocket persistent connection is established, the mobile phone and the home storage device respectively send a service type identifier and a service scenario identifier corresponding to the data to be transmitted to the protocol configuration gateway.
[0147] In some possible implementations, after the mobile phone and the home storage device are powered on, in the scenario where the mobile phone needs to send or transfer files to the home storage device, that is, the mobile phone needs to store files in the home storage device, since the mobile phone, the home storage device, and the protocol configuration gateway all support the "Websocket persistent connection" function, the mobile phone and the home storage device will call the SDK's "gatewayConnect" interface to establish a Websocket persistent connection with the protocol configuration gateway. After the mobile phone and the home storage device respectively establish a Websocket persistent connection with the protocol configuration gateway, the mobile phone and the home storage device will respectively send the service type identifier and service scenario identifier corresponding to the data transmission (i.e., the data to be transmitted) to the protocol configuration gateway through the Websocket persistent connection.
[0148] For example, suppose that the IP address and port number of the protocol configuration gateway are 123.11.10.11:5223, and the data transmission is: the mobile phone needs to send or transfer files to the home storage device. The APP ID corresponding to the home storage device is "001", that is, the business type identifier corresponding to the home storage device is "001", and the business scenario identifier (APPtype) corresponding to the file transfer is "File". The mobile phone calls the "gatewayConnect" interface of the SDK, and sends the APP ID and APP type corresponding to the device receiving the file (that is, the home storage device), that is, "APP ID = 001", "APP type = File" and other parameters or information to the protocol configuration gateway through a Websocket long connection. Similarly, the home storage device will also call the "gatewayConnect" interface of the SDK, and send the parameters or information "APP ID = 001", "APP type = File" and other parameters or information to the protocol configuration gateway through a Websocket long connection.
[0149] It should be understood that before executing S410, the mobile phone and the home storage device may first perform a device discovery and binding process. For example, the mobile phone may perform a device binding and discovery process with the home storage device by "scanning" or "touching". For another example, when the mobile phone and the home storage device are in the same local area network (for example, connected to the same Wi-Fi hotspot, etc.), the user may open the "Smart Life" APP on the mobile phone, enter the account number and password, and after logging in successfully, the mobile phone interface may automatically pop up a prompt box to prompt the user that the home storage device has been discovered. The user may click the icon corresponding to the "home storage device" to complete the device discovery and binding of the mobile phone and the home storage device. After completing the device discovery and binding of the mobile phone and the home storage device, the mobile phone may communicate with the home storage device, and the mobile phone may obtain the APP ID corresponding to the home storage device. When the mobile phone needs to send a file to the home storage device, the mobile phone may inform the home storage device that it needs to send a file to the home storage device, so that the home storage device can determine that the "APP type" is File.
[0150] Optionally, as a possible implementation method, in an embodiment of the present application, for a terminal device, the corresponding APP ID may be unique. For example, for a home storage device, the corresponding APP ID may be simply "001", i.e., home storage. For a terminal device, the corresponding APP type may also be unique. For example, for a home storage device, the corresponding APP type may be simply "File", i.e., file transfer or storage. If the APP ID and APP type corresponding to a terminal device are both unique, then after the terminal device and the protocol configuration gateway establish a Websocket long connection, the terminal device can send its own APP ID and APP type to the protocol configuration gateway.
[0151] As another possible implementation, for a terminal device, the corresponding APP ID may not be unique. For example, for a mobile phone, the corresponding APP ID may include: "002", "003", "004", etc. For a terminal device, it may also correspond to multiple different APP types. For example, for a mobile phone, the corresponding APP type may include: "File", "Video", "Audio", "Text", etc. For a sending device and a receiving device that perform data transmission using the method provided in an embodiment of the present application, before the sending device and the receiving device respectively send a service type identifier and a service scenario identifier to the protocol configuration gateway, they can communicate with each other during the device discovery and binding process or after the device discovery and binding. For example, the sending device can send information to the receiving device to notify the data to be transmitted to the receiving end. What is the corresponding service type and service scenario? Based on the information, the receiving device can know which APP ID and APP type the data transmission specifically corresponds to. For example, assuming that the sending device is a mobile phone and the receiving device is a large-screen device, the mobile phone corresponds to multiple APP IDs and multiple APP types, and the large-screen device also corresponds to multiple APP IDs and multiple APP types. The mobile phone needs to transmit video to the large-screen device through Changlian. In this case, the mobile phone can send information to the large-screen device to inform the large-screen device that it needs to transmit video to the large-screen device through Changlian. Since both the mobile phone and the large-screen device store the same information of business type identification and business scenario identification, such as shown in Table 1, the large-screen device can determine that: APP type is "Vedio" and APP ID is "002"; the mobile phone can also know: APP type is "Vedio" and APP ID is "002".
[0152] Optionally, in an embodiment of the present application, during the process of establishing a Websocket persistent connection between the sending device and the receiving device and the protocol configuration gateway, one possible implementation method is: during the process of establishing the Websocket persistent connection, the APP ID and APP type need to be sent to the protocol configuration gateway; another possible implementation method is: during the process of establishing the persistent connection, the APP ID and APP type do not need to be sent to the protocol configuration gateway. After the Websocket persistent connection is established, when there is data to be transmitted, the sending device and the receiving device can respectively send the APP ID and APP type to the protocol configuration gateway through the Websocket persistent connection.
[0153] The process corresponding to the above S410 is Figure 5 Step 1 shown in: Establishment of Websocket persistent connection.
[0154] It should be understood that in the embodiment of the present application, as a possible implementation method, for S410, the process of establishing a Websocket long connection between the mobile phone and the protocol configuration gateway, and the process of establishing a Websocket long connection between the home storage device and the protocol configuration gateway may be asynchronous or non-synchronous. For example, for the home storage device, its corresponding APP ID and APP type are both unique. Therefore, after the home storage device is powered on, the home storage device can establish a Websocket long connection with the protocol configuration gateway, and send the corresponding APP ID and APP type to the protocol configuration gateway during the long connection establishment process. For devices (such as mobile phones) that can correspond to multiple APP IDs and / or multiple APP types, one possible implementation method is: establish a Websocket long connection with the protocol configuration gateway when there is data transmission, and send the corresponding APP ID and APP type to the protocol configuration gateway during the connection process; another possible implementation method is: after the device is powered on, a Websocket long connection can be established with the protocol configuration gateway, but it is not necessary to send the APP ID and APP type to the protocol configuration gateway during the connection process. When there is data transmission, the APP ID and APP type are sent to the protocol configuration gateway through the Websocket long connection. In other words, the sending device and the receiving device may not establish a Websocket persistent connection with the protocol configuration gateway at the same time. The sending device and the receiving device may not send the APP ID and APP type to the protocol configuration gateway at the same time.
[0155] In the embodiment of the present application, as a possible implementation method, for the mobile phone and the home storage device to establish a Websocket long connection with the protocol configuration gateway respectively, for example, after the mobile phone and the home storage device are turned on, the mobile phone needs to transfer files to the home storage device, and the process of establishing a Websocket long connection can be executed. In other words, the process of establishing a Websocket long connection can be triggered by "there is data that needs to be transferred between the mobile phone and the home storage device". As another possible implementation method, after the mobile phone and the home storage device are configured, the mobile phone and the home storage device trigger the remote connection for the first time. For example, after the user clicks on the device card or icon corresponding to "home storage device" in the "Smart Life" APP interface of the mobile phone, the mobile phone and the home storage device can be triggered to establish a Websocket long connection with the protocol configuration gateway respectively. As another possible implementation method, after the mobile phone and the home storage device are configured, for example, when the user sets the gallery application or other applications on the mobile phone to "automatically synchronize data to the home storage device", the mobile phone and the home storage device can be triggered to establish a Websocket long connection with the protocol configuration gateway respectively. As another possible implementation, for example, after the mobile phone and the home storage device are turned on, the mobile phone opens a certain application, which triggers the mobile phone to establish a Websocket long connection with the protocol configuration gateway. In other words, the process of establishing a Websocket long connection can be triggered by "the mobile phone opens a certain application". As another possible implementation, for IOT devices, for example, after the mobile phone and the home storage device are turned on respectively, the mobile phone and the home storage device can be triggered to establish a Websocket long connection with the protocol configuration gateway respectively. In other words, the process of establishing a Websocket long connection can be triggered by "device power on". In this case, for a device (such as a mobile phone) that can correspond to multiple APP IDs and / or multiple APP types, a Websocket long connection can be established with the protocol configuration gateway after the device is turned on, but it is not necessary to send the APP ID and APP type to the protocol configuration gateway during the long connection. When there is data transmission, the APP ID and APP type are sent to the protocol configuration gateway through the Websocket long connection.
[0156] For example, Figure 6 The diagram shows a schematic interface diagram of a scenario in which a mobile phone and a home storage device respectively establish a Websocket persistent connection with a protocol configuration gateway. Figure 6 As shown in Figure a, the user can click the icon corresponding to the "Smart Life" APP on the mobile phone. After the user clicks, the interface displayed on the mobile phone changes to Figure 6 The interface shown in Figure a jumps to Figure 6The interface shown in Figure b. Figure 6 In the interface shown in Figure b, the user can click the icon corresponding to the "home storage device". After the user clicks the icon corresponding to the "home storage device", the mobile phone and the home storage device can be triggered to establish a Websocket long connection with the protocol configuration gateway respectively.
[0157] For example, Figure 7 The following is a schematic interface diagram of another scenario in which a mobile phone and a home storage device respectively establish a Websocket persistent connection with a protocol configuration gateway. A user can open the photo album application on the mobile phone. After opening the photo album application, the interface of the mobile phone is as follows: Figure 7 As shown in Figure a, users can choose to browse or download photos on their own device or other devices. If the user clicks the "Other Devices" control, the interface displayed on the phone will be changed to Figure 7 The interface shown in Figure a jumps to Figure 7 The interface shown in Figure b. Figure 7 In the interface shown in Figure b, there are task cards corresponding to other devices associated with the local device (for example, logged in with the same account as the local device, connected to the same Wi-Fi hotspot, logged in with an associated account, or established in the same network to form a LAN device group, etc.), including, for example: Huawei M7, Honor Smart Screen, home storage device, etc. Assume that the user clicks on the task card corresponding to "Home Storage Device". After clicking, it can trigger the mobile phone and home storage device to establish a Websocket long connection with the protocol configuration gateway respectively. After the Websocket long connection is established, the mobile phone and home storage device can respectively send the service type identifier (APP ID=001) and the service scenario identifier (APP type=File) to the protocol configuration gateway, and then S420 to S460 can be executed. After the user clicks on the task card corresponding to "Home Storage Device", the interface displayed on the mobile phone changes to: Figure 7 The interface shown in Figure b jumps to Figure 7 The interface shown in Figure c. Figure 7 The interface shown in Figure c shows photos stored on home storage devices. Users can choose photos from any category (for example: albums, screenshots, Huawei share, Weibo, WeChat, etc.) to browse or download them to their local computer according to their needs.
[0158] It should be understood that Figure 6 and Figure 7The interface diagram shown is only exemplary and should not impose any restrictions on the interface in which the user triggers the mobile phone and the home storage device to establish a Websocket persistent connection with the protocol configuration gateway in the embodiments of the present application. For example, in other embodiments of the present application, the icons on the interface displayed by the mobile phone may include Figure 6 and Figure 7 More or fewer icons may be displayed on the interface, or some icons may be combined, or some icons may be split, or different icons may be displayed, etc. The present application embodiment is not limited here.
[0159] It should also be understood that in other implementations of the present application, the mobile phone may send the service type identifier and the service scenario identifier to the protocol configuration gateway, while the home storage device may not need to send the service type identifier and the service scenario identifier to the protocol configuration gateway. Alternatively, the home storage device may send the service type identifier and the service scenario identifier to the protocol configuration gateway, while the mobile phone may not need to send the service type identifier and the service scenario identifier to the protocol configuration gateway.
[0160] S420, the mobile phone and the home storage device respectively obtain KCP protocol parameters corresponding to the service type and service scenario configured by the protocol configuration gateway.
[0161] In some possible implementations, the protocol configuration gateway determines that the business type corresponding to the current data transmission is home storage, and the business scenario is file transfer, that is, the file transfer scenario of the home storage device, based on the obtained "APP ID = 001" and "APPtype = File". The protocol configuration gateway determines the KCP protocol parameters corresponding to the business type and business scenario based on the business type and business scenario, and sends the KCP protocol parameters to the mobile phone and home storage device respectively. Both the mobile phone and the home storage device will call the "recevieKcpConfig" interface of the SDK to receive the KCP protocol parameters configured by the protocol configuration gateway.
[0162] Optionally, in the embodiment of the present application, the file transmission scenario of the home storage device may include: the first scenario: the mobile phone transmits files to the home storage device, that is, the mobile phone stores the files or data on the home storage device. Figure 7 as well as Figure 8 The scenario shown is that a mobile phone stores files on a home storage device. In this case, the mobile phone is a sending device and the home storage device is a receiving device. The second scenario is that the home storage device transmits files or data to the mobile phone, that is, downloads the files or data stored on the home storage device to the mobile phone. In this case, the home storage device is a sending device and the mobile phone is a receiving device.
[0163] Exemplarily, the KCP protocol parameters corresponding to the business type and business scenario determined by the protocol configuration gateway according to the above-mentioned business type and business scenario may include:
[0164] KCP_MTU 1300;
[0165] KCP_RCV_WINSIZE 512;
[0166] KCP_SND_WINSIZE 512;
[0167] KCP_NO_CWND 1;
[0168] Among them, KCP_MTU 1300 is used to identify the MTU of the KCP protocol (i.e., the threshold of the size of the KCP protocol data packet) as 1300KB; KCP_RCV_WINSIZE 512 is used to identify the receiving window size of the KCP protocol as 512KB; KCP_SND_WINSIZE 512 is used to identify the sending window size of the KCP protocol as 512KB; KCP_NO_CWND 1 is used to indicate that flow control is turned off (i.e., the flow control switch is turned off). For example, if the flow control switch is turned on, mobile phones and home storage devices can use the flow control rules of the KCP protocol to adjust the data transmission speed according to the network status, etc. If the flow control switch is turned off, mobile phones and home storage devices will not use the flow control rules of the KCP protocol to adjust the data transmission speed.
[0169] It should be understood that in other implementations of the present application, the KCP protocol parameters may also include other KCP protocol parameters. Moreover, for different service types and service scenarios, the values of each KCP protocol parameter may also be other values, which are not limited in the embodiments of the present application. For example, in the above example, the value of KCP_NO_CWND may also be 0, indicating that flow control is turned on.
[0170] It should be understood that in the embodiments of the present application, the values of the KCP protocol parameters corresponding to different service types and / or service scenarios are different. For example, when a mobile phone sends a picture to a home storage device, the corresponding values of the three parameters KCP_MTU, KCP_RCV_WINSIZE, and KCP_SND_WINSIZE may be different from the values of the three parameters KCP_MTU, KCP_RCV_WINSIZE, and KCP_SND_WINSIZE when the mobile phone sends a video or audio to a home storage device. For example, the values of the three parameters corresponding to the video or audio may be respectively greater than the values of the three parameters corresponding to the picture.
[0171] The process corresponding to the above S420 is Figure 5Step 2 shown in: KCP protocol parameters are sent.
[0172] In other implementations of the present application, in S410, if the mobile phone sends the service type identifier and service scenario identifier corresponding to the data to be transmitted to the protocol configuration gateway, and the home storage device does not send the service type identifier and service scenario identifier corresponding to the data to be transmitted to the protocol configuration gateway. In this case, the mobile phone can communicate with the protocol configuration gateway in advance, and the mobile phone can notify the protocol configuration gateway of the IP address, device number and other information of the peer device (home storage device) of this data transmission; or, the mobile phone can also send the IP address, device number and other information of the peer device (home storage device) of this data transmission, as well as the service type identifier and service scenario identifier of this data transmission to the protocol configuration gateway. Based on this information, the protocol configuration gateway can determine the information of the peer device (home storage device), and thus send: KCP protocol parameters, service type identifier and service scenario identifier corresponding to the data to be transmitted to the home storage device.
[0173] In other implementations of the present application, in S410, if the home storage device sends the service type identifier and service scenario identifier corresponding to the data to be transmitted to the protocol configuration gateway, and the mobile phone does not send the service type identifier and service scenario identifier corresponding to the data to be transmitted to the protocol configuration gateway. In this case, the home storage device can communicate with the protocol configuration gateway in advance, and the home storage device can notify the protocol configuration gateway of the IP address, device number and other information of the peer device (mobile phone) of the data transmission; or, the home storage device can also send the IP address, device number and other information of the peer device (mobile phone) of this data transmission, as well as the service type identifier and service scenario identifier of this data transmission to the protocol configuration gateway. Based on this information, the protocol configuration gateway can determine the information of the peer device (mobile phone), and thus send: KCP protocol parameters, service type identifier and service scenario identifier to the mobile phone.
[0174] By configuring the gateway through the protocol, the KCP protocol parameters corresponding to the business type and business scenario are determined according to the business type and business scenario, and the KCP protocol parameters are sent to the sending device (such as a mobile phone) and the receiving device (such as a home storage device) for transmitting data. It can dynamically adjust the transmission parameters based on the KCP protocol (such as the size of the KCP protocol data packet, transmission speed, etc.) for different business types and business scenarios, thereby improving the utilization efficiency of communication resources and ensuring the efficiency of data transmission.
[0175] S430, the protocol configuration gateway configures and sends to the TURN server: TURN protocol parameters corresponding to the service type and service scenario, an identifier of the service type, and an identifier of the service scenario.
[0176] In some possible implementations, the protocol configuration gateway determines that the service type corresponding to the current data transmission is home storage, and the service scenario is file transfer, i.e., the home storage file transfer scenario, based on the obtained "APP ID = 001" and "APP type = File". The protocol configuration gateway determines the TURN protocol parameters corresponding to the service type and service scenario based on the service type and service scenario, and sends the TURN protocol parameters to the TURN server (including Figure 5 The first TURN server and the second TURN server shown in FIG. 4 send the TURN protocol parameters, the identification of the service type, and the identification of the service scenario.
[0177] Exemplarily, the protocol configuration gateway determines, based on the service type and service scenario, that the TURN protocol parameters corresponding to the service type and service scenario may include: bandwidth threshold (bps_capacity). For example, the value of the bandwidth threshold (also referred to as the first bandwidth threshold) may be 50Mbps, that is, in the file transfer scenario of home storage, the maximum bandwidth limited by the TURN server is 50Mbps, and the bandwidth of the TURN server receiving and sending data packets cannot be greater than 50Mbps. Of course, the value of the bandwidth threshold may also be other values, which are not limited in the embodiments of the present application.
[0178] It should be understood that in other implementations of the present application, the TURN protocol parameters may also include other TURN protocol parameters. Moreover, for different service types and service scenarios, the values of the TURN protocol parameters may also be other values, which are not limited in the embodiments of the present application.
[0179] It should be understood that in the embodiments of the present application, different service types and / or service scenarios have different corresponding bandwidth thresholds. For example, when a mobile phone sends a picture to a home storage device, the corresponding bandwidth threshold may be different from that when a mobile phone sends a video or audio to a home storage device. For example, the bandwidth threshold corresponding to a video or audio may be greater than the bandwidth threshold corresponding to a picture.
[0180] The process corresponding to the above S430 is Figure 5 Step 3 shown in : TURN protocol parameters are sent.
[0181] The protocol configuration gateway determines the TURN protocol transmission bandwidth threshold corresponding to the service type and service scenario according to the service type and service scenario, and sends the bandwidth threshold to the TURN server. On the one hand, it can dynamically adjust the transmission speed based on the TURN protocol for different service types and service scenarios, improve the efficiency of communication resource utilization, and ensure the efficiency of data transmission. On the other hand, since the TURN protocol transmission bandwidth threshold and KCP protocol parameters are determined by the protocol configuration gateway according to the same service type and service scenario, it can ensure that the data transmission and reception speed of the terminal side (such as mobile phones and home storage devices) matches the bandwidth limit of the cloud side TURN server, which improves the efficiency of communication resource utilization and ensures the efficiency of data transmission.
[0182] S440, the mobile phone and the home storage device obtain the public IP address and port number assigned by the TURN server.
[0183] In S440, the mobile phone and the home storage device both call the SDK's "turnAllocate" interface and send request information to the TURN server, respectively, which is used to request the TURN server to allocate a public IP address and port number for them. The URN server sends the public IP address and port number to the mobile phone and the home storage device respectively according to the received request information.
[0184] Assume that the TURN server assigns a public IP address and port number to the mobile phone: 124.71.104.60:20100. The TURN server assigns a public IP address and port number to the home storage device: 124.71.104.61:20101.
[0185] It should be understood that in the embodiment of the present application, if there is only one TURN server, in this case, the public network IP addresses assigned by the TURN server to the mobile phone and the home storage device can be the same, but the port numbers are different. If there are multiple TURN servers, for example, the mobile phone and the home storage device each request an IP address and a port number from a TURN server, then the public network IP addresses corresponding to the mobile phone and the home storage device can be different, and the port numbers can also be different, for example, Figure 5 The example shown is a scenario where a mobile phone and a home storage device respectively request a TURN server to allocate an IP address and a port number.
[0186] The process corresponding to the above S440 is Figure 5 Step 4 shown in: Allocation of addresses and port numbers under the TURN protocol.
[0187] S450, a protocol configuration gateway is configured between the mobile phone and the home storage device to exchange their respective public network IP addresses and port numbers.
[0188] In S450, assuming that the IP address and port number of the protocol configuration gateway are: 123.11.10.11:5223, the mobile phone can call the "signaturnExchange" interface of the SDK, input the parameters "123.11.10.11:5223" and "124.71.104.60:20100", and transmit it to the protocol configuration gateway through the transmission channel (Websocket long connection) between the mobile phone and the protocol configuration gateway. The protocol configuration gateway transmits "124.71.104.60:20100" to the home storage device through the transmission channel (Websocket long connection) between the protocol configuration gateway and the home storage device, so that the home storage device learns the public IP address and port number of the mobile phone. The home storage device can also call the "signaturnExchange" interface of the SDK, input the parameters "123.11.10.11:5223" and "124.71.104.61:20101", and transmit it to the protocol configuration gateway through the transmission channel (Websocket long connection) between the home storage device and the protocol configuration gateway. The protocol configuration gateway transmits "124.71.104.61:20101" to the mobile phone through the transmission channel (Websocket long connection) between the protocol configuration gateway and the mobile phone, so that the mobile phone learns the public IP address and port number of the home storage device. That is, the exchange of the public IP addresses and port numbers of both devices is completed.
[0189] The process corresponding to the above S450 is Figure 8 Step 5 shown in: Signaling interaction.
[0190] In an embodiment of the present application, signaling interaction between devices is performed by reusing the Websocket long connection transmission channel, that is, the respective public IP addresses and port numbers are exchanged through the protocol configuration gateway, without the need to introduce additional signaling interaction servers. This can reduce the number of network elements required by the system and the number of long connections that need to be established, thereby reducing the complexity of system implementation.
[0191] S460, the mobile phone sends files to the home storage device based on the KCP protocol and TURN protocol.
[0192] Before sending a file to the home storage device, the mobile phone will call the SDK's "config KCP Set" interface and set the KCP protocol parameters obtained in S420 to the "ikcp_send" interface. The home storage device will also call the SDK's "configKCP Set" interface and set the KCP protocol parameters obtained in S420 to the current interface. When the mobile phone sends a file to the home storage device, or when the home storage device sends a file to the mobile phone, the KCP protocol parameters will be used to send the data.
[0193] Assume that: the IP address and port number of the first TURN server connected to the mobile phone are: 124.71.104.60:5349; the IP address and port number of the second TURN server connected to the home storage device are: 124.71.104.61:5349; there is a communication connection between the first TURN server and the second TURN server.
[0194] The phone will call the "ikcp_send" interface and enter the following information:
[0195] "APP ID = 001", "APP type = File", the address of the home storage device (dstAdr) = 124.71.104.61:20101, the address of the first TURN server (turnAddr) = 124.71.104.60:5349, the file to be transmitted (data) = file1. That is, the mobile phone starts to transfer files to the home storage device. The mobile phone calls the "ikcp_send" interface, which is based on the KCP protocol and uses the previously configured KCP protocol parameters (such as the KCP protocol parameters shown in S420). The mobile phone sends data to the first TURN server based on the KCP protocol, replacing the original mobile phone sending data to the first TURN server based on the UDP protocol. In other words, the mobile phone transmits data packets based on the KCP protocol in the transmission channel established with the first TURN server based on the TURN protocol. The original one was: the mobile phone transmits data packets based on the UDP protocol in the transmission channel established with the first TURN server based on the TURN protocol. The mobile phone only needs to pass the data (file) to be transmitted to the "ikcp_send" interface, and the "ikcp_send" interface will use the KCP protocol to send data to the first TURN server. During the data transmission process, the business layer does not need to implement reliable transmission itself, which ensures the reliable transmission of data and improves the efficiency of data transmission.
[0196] When the first TURN server receives the data sent by the mobile phone, it will obtain the corresponding TURN protocol parameters according to "APP ID = 001" and "APPtype = File", for example, the TURN protocol parameters include a bandwidth threshold. The first TURN server uses the bandwidth threshold to control the speed of receiving data packets from the mobile phone. After the first TURN server receives the data from the mobile phone, it uses the bandwidth threshold to control the speed of sending data to the second TURN server. The data sent by the first TURN server to the second TURN server carries the following information:
[0197] "APP ID = 001", "APP type = File", address of the home storage device (dstAdr) = 124.71.104.61:20101, address of the second TURN server (turnAddr) = 124.71.104.61:5349, file to be transmitted (data) = file1.
[0198] After receiving the data sent by the first TURN server, the second TURN server will obtain the corresponding TURN protocol parameters, such as bandwidth threshold, etc. according to "APP ID = 001" and "APP type = File". The second TURN server uses the bandwidth threshold to control the receiving speed of the data from the first TURN server. It should be understood that the communication link or transmission channel between the first TURN server and the second TURN server is established based on the TURN protocol, but the data packets transmitted in the communication link or transmission channel are also based on the KCP protocol.
[0199] After receiving the data from the first TURN server, the second TURN server uses the bandwidth threshold to control the speed of sending data to the home storage device. The data sent by the second TURN server to the home storage device carries the following information:
[0200] "APP ID = 001", "APP type = File", address of home storage device (dstAdr) = 124.71.104.61:20101, file to be transmitted (data) = file1.
[0201] The second TURN server sends data to the home storage device based on the KCP protocol, replacing the original second TURN server sending data to the home storage device based on the UDP protocol. In other words, the second TURN server transmits data packets based on the KCP protocol in the transmission channel established with the home storage device based on the TURN protocol. The original one was: the second TURN server transmits data packets based on the UDP protocol in the transmission channel established with the home storage device based on the TURN protocol. The second TURN server will send data to the home storage device based on the KCP protocol parameters (such as the parameters shown in S420). During the data transmission process, the business layer does not need to implement reliable transmission itself, which ensures the reliable transmission of data, thereby improving the efficiency of data transmission.
[0202] It should be understood that in S460, although the entire transmission link or transmission channel is established based on the TURN protocol, the entire transmission channel includes: the transmission channel between the mobile phone and the first TURN server, the transmission channel between the first TURN server and the second TURN server, and the transmission channel between the second TURN server and the home storage device. However, what is transmitted in the entire transmission channel is a data packet based on the KCP protocol. In other words, in an embodiment of the present application, the TURN protocol is based on the KCP protocol, or in other words, in a data transmission channel based on the TURN protocol, what is transmitted is a data packet based on the KCP protocol.
[0203] The process corresponding to the above S460 is Figure 8 Step 6 shown in: Data transmission based on KCP protocol and TURN protocol.
[0204] For example, Fig. 9 An example is shown in Figure 5 The example shown is a schematic diagram of data transmission, from Fig. 9It can be seen that the process of transmitting data between the mobile phone and the first TURN server is based on the KCP protocol, and the KCP protocol parameters corresponding to the file transfer scenario of home storage are used. The process of transmitting data between the second TURN server and the home storage device is also based on the KCP protocol, and the KCP protocol parameters corresponding to the file transfer scenario of home storage are also used. When the first TURN server receives data from the mobile phone and forwards the data to the second TURN server, it uses the TURN protocol parameters (such as bandwidth threshold) corresponding to the file transfer scenario of home storage ("APP ID = 001", "APP type = File"). When the second TURN server receives data from the first TURN server and forwards the data to the home storage device, it uses the TURN protocol parameters (such as bandwidth threshold) corresponding to the file transfer scenario of home storage. The entire transmission process is a transmission process based on the TURN protocol, but the data packets transmitted in the entire transmission process are data packets based on the KCP protocol and KCP protocol parameters.
[0205] After the above steps S410 to S460, the file "file1" can be transferred from the mobile phone to the home storage device.
[0206] The data transmission method provided in this application is designed with a unified SDK, which has functions such as KCP protocol support, TURN protocol support, protocol configuration parameter update, and network socket long connection. One SDK can be used to conveniently implement far-field data transmission. The protocol configuration gateway can configure KCP protocol parameters and TURN protocol parameters (including bandwidth thresholds) corresponding to different business types and business scenarios, and send them to the two devices of the data transmission and the TURN server respectively, so as to realize dynamic adjustment of the transmission speed based on the KCP protocol and the TURN protocol, improve the efficiency of communication resource utilization, and ensure the efficiency of data transmission. The KCP protocol and the TURN protocol are integrated. The two devices of the data transmission are based on the TURN protocol. After obtaining the public network address and port based on the TURN protocol, the public network address and port based on the TURN protocol are used to establish a transmission channel based on the TURN protocol. When users transmit data remotely, in the transmission channel established based on the TURN protocol, KCP packets are transmitted based on the KCP protocol and using KCP protocol parameters corresponding to the service type and service scenario. Compared with using the UDP protocol to transmit data, the service layer does not need to implement reliable transmission by itself, which ensures reliable data transmission and improves the efficiency of data transmission. In the process of forwarding data, the TURN server uses the TURN protocol transmission speed corresponding to the service type and service scenario to forward data, ensuring that the data transmission and reception speed on the end side matches the bandwidth limit of the TURN server on the cloud side, improving the efficiency of communication resource utilization and ensuring the efficiency of data transmission. By reusing the Websocket long connection transmission channel between the client and the protocol configuration gateway for signaling interaction between devices, that is, exchanging their respective public network IP addresses and port numbers through the protocol configuration gateway, there is no need to introduce additional signaling interaction servers, which can reduce the number of network elements required by the system and the number of long connections that need to be established, and reduce the complexity of system implementation.
[0207] Optionally, as another possible implementation manner, for example, when the service type and / or service scenario changes, a possible implementation manner is: re-execute S410 to S460 according to the new service type and / or new service scenario.
[0208] If S410 is replaced by: the two devices of the data transmission establish a long connection with the protocol configuration gateway, but do not report the identification of the service type and the identification of the service scenario to the protocol configuration gateway. In the case of changes in the service type and / or service scenario, the two devices of the data transmission can report the identification of the service type and the identification of the service scenario to the protocol configuration gateway based on the established long connection, and then S420 to S460 can be executed.
[0209] It should also be understood that in other implementations of the present application, the KCP protocol in the above example can also be replaced by a quick UDP internet connections (QUIC) protocol or other possible protocols. In other words, in other implementations of the present application, the above descriptions related to the KCP protocol can be replaced by the QUIC protocol or other possible protocols. The embodiments of the present application are not limited here.
[0210] It should be understood that the above is only to help those skilled in the art better understand the embodiments of the present application, rather than to limit the scope of the embodiments of the present application. According to the above examples given, those skilled in the art can obviously make various equivalent modifications or changes, for example, some steps in each method of the above method may not be necessary, or some new steps may be added. Or a combination of any two or any multiple embodiments of the above. Such modifications, changes or combined solutions also fall within the scope of the embodiments of the present application.
[0211] It should also be understood that the division of the methods, situations, categories and embodiments in the embodiments of the present application is only for the convenience of description and should not constitute a special limitation. The features of various methods, categories, situations and embodiments can be combined without contradiction.
[0212] It should also be understood that the various numerical numbers involved in the embodiments of the present application are only for the convenience of description and are not used to limit the scope of the embodiments of the present application. The size of the sequence number of the above-mentioned processes does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0213] It should also be understood that the above description of the embodiments of the present application focuses on emphasizing the differences between the various embodiments. The same or similar points that are not mentioned can be referenced to each other. For the sake of brevity, they will not be repeated here.
[0214] The above combination Figure 2-Figure 9 The embodiments of the method and system provided by the embodiments of the present application are described, and the communication device provided by the embodiments of the present application is described below.
[0215] In this embodiment, each device (including the above-mentioned first terminal device (such as a mobile phone), the second terminal device (such as a home storage device), the protocol configuration gateway, and the TURN server) can be divided into functional modules according to the above method. For example, each function can be divided into various functional modules, or two or more functions can be integrated into one processing module. The above-mentioned integrated modules can be implemented in the form of hardware. It should be noted that the division of modules in this embodiment is schematic, which is only a logical function division, and there may be other division methods in actual implementation.
[0216] It should be noted that the relevant contents of each step involved in the above method embodiment can all be referred to the functional description of the corresponding functional module, which will not be repeated here.
[0217] The communication device (including the above-mentioned terminal device, protocol configuration gateway, TURN server) provided in the embodiment of the present application is used to execute the data transmission method provided in the above-mentioned method embodiment, so that the same effect as the above-mentioned implementation method can be achieved. In the case of an integrated unit, the terminal device, the protocol configuration gateway or the TURN server may include a processing module, a storage module and a communication module. Among them, the processing module can be used to control and manage the actions of the terminal device, the protocol configuration gateway or the TURN server. For example, it can be used to support the terminal device, the protocol configuration gateway or the TURN server to execute the steps performed by the processing unit. The storage module can be used to support the storage of program codes and data, etc. The communication module can be used to support the communication between the terminal device, the protocol configuration gateway or the TURN server and other devices.
[0218] Among them, the processing module can be a processor or a controller. It can be a device that implements or executes various exemplary logic boxes, modules and circuits described in conjunction with the disclosure of this application. The processor can also be a combination that implements computing functions, such as a combination of one or more microprocessors, a combination of digital signal processing (DSP) and a microprocessor, etc. The storage module can be a memory. The communication module can specifically be a device that interacts with other terminal devices, such as a radio frequency circuit, a Bluetooth chip, a Wi-Fi chip, etc.
[0219] For example, Fig.10 FIG. 1 is a schematic diagram of the hardware structure of an example of a communication device 1000 provided in the present application. The communication device 1000 may be the above-mentioned terminal device, for example, the terminal device may be a smart phone, a home storage device, a tablet computer, a laptop computer, etc. Fig.10As shown, the communication device 1000 may include a processor 1010, an external memory interface 1020, an internal memory 1021, a universal serial bus (USB) interface 1030, a charging management module 1040, a power management module 1041, a battery 1042, an antenna 1, an antenna 2, a wireless communication module 1050, and the like.
[0220] It is to be understood that the structure illustrated in the embodiment of the present application does not constitute a specific limitation on the communication device 1000. In other embodiments of the present application, the communication device 1000 may include more or fewer components than shown in the figure, or combine certain components, or split certain components, or arrange the components differently. The components shown in the figure may be implemented in hardware, software, or a combination of software and hardware.
[0221] For example, when the communication device 1000 is a mobile phone or a computer, the communication device may further include a display screen.
[0222] The processor 1010 may include one or more processing units. For example, the processor 1010 may include an application processor (AP), a modem processor, a graphics processor (GPU), an image signal processor (ISP), a controller, a video codec, a digital signal processor (DSP), a baseband processor, and / or a neural-network processing unit (NPU), etc. Different processing units may be independent components or integrated into one or more processors. In some embodiments, the communication device 1000 may also include one or more processors 1010. The controller may generate an operation control signal according to the instruction opcode and the timing signal to complete the control of fetching and executing instructions.
[0223] In some embodiments, the processor 1010 may include one or more interfaces. The interface may include an inter-integrated circuit (I2C) interface, an integrated circuit sound (I2S) interface, a pulse code modulation (PCM) interface, a universal asynchronous receiver / transmitter (UART) interface, a mobile industry processor interface (MIPI), a general-purpose input / output (GPIO) interface, a SIM card interface, and / or a USB interface, etc. Among them, the USB interface 1030 is an interface that complies with the USB standard specification, and specifically can be a Mini USB interface, a Micro USB interface, a USB Type C interface, etc. The USB interface 1030 can be used to connect a charger to charge the communication device 1000, and can also be used to transmit data between the communication device 1000 and a peripheral device.
[0224] It is understandable that the interface connection relationship between the modules illustrated in the embodiment of the present application is only a schematic illustration and does not constitute a structural limitation on the communication device 1000. In other embodiments of the present application, the communication device 1000 may also adopt different interface connection methods in the above embodiments, or a combination of multiple interface connection methods.
[0225] The wireless communication function of the communication device 1000 can be implemented through the antenna 1, the antenna 2 and the wireless communication module 1050.
[0226] The wireless communication module 1050 can provide wireless communication solutions including Wi-Fi (including Wi-Fi sensing and Wi-Fi AP), Bluetooth (BT), wireless data transmission module (for example, 433MHz, 868MHz, 10110MHz) applied to the communication device 1000. The wireless communication module 1050 can be one or more devices integrating at least one communication processing module. The wireless communication module 1050 receives electromagnetic waves via antenna 1 or antenna 2 (or, antenna 1 and antenna 2), filters and frequency modulates the electromagnetic wave signal, and sends the processed signal to the processor 1010. The wireless communication module 1050 can also receive the signal to be sent from the processor 1010, frequency modulate it, amplify it, and convert it into electromagnetic waves for radiation through antenna 1 or antenna 2.
[0227] The external memory interface 1020 can be used to connect an external memory card, such as a Micro SD card, to expand the storage capacity of the communication device 1000. The external memory card communicates with the processor 1010 through the external memory interface 1020 to implement a data storage function, such as storing music, video and other files in the external memory card.
[0228] The internal memory 1021 can be used to store one or more computer programs, which include instructions. The processor 1010 can execute the above instructions stored in the internal memory 1021, so that the communication device 1000 performs the data transmission method provided in some embodiments of the present application, as well as various applications and data processing. The internal memory 1021 may include a code storage area and a data storage area. Among them, the code storage area can store an operating system. The data storage area can store data created during the use of the communication device 1000, etc. In addition, the internal memory 1021 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more disk storage components, a flash memory component, a universal flash storage (universal flash storage, UFS), etc. In some embodiments, the processor 1010 can execute the data transmission method provided in the embodiment of the present application by running the instructions stored in the internal memory 1021, and / or the instructions stored in the memory provided in the processor 1010.
[0229] It should be understood that the specific process of the communication device 1000 performing the above corresponding steps can be referred to in conjunction with the above Figures 4 to 9 The description of the steps executed by the mobile phone (or home storage device) described in is not repeated here for the sake of brevity.
[0230] Fig.11 A schematic block diagram of another example of a communication device 1100 provided in an embodiment of the present application is shown. The communication device 1100 may correspond to the terminal device (e.g., a mobile phone or a home storage device) described in each embodiment of the above method 400, or may be a chip or component applied to the terminal device. In addition, each module or unit in the communication device 1100 is used to execute each action or processing process performed by the terminal device (mobile phone or home storage device) described in each embodiment of the above method 400, such as Fig.11 As shown, the communication device 1100 may include: a processing unit 1110 and a communication unit 1120. Optionally, the communication device 1100 may further include a storage unit 1130.
[0231] It should be understood that the specific process of each unit in the communication device 1100 performing the above corresponding steps can be referred to in conjunction with the above Figures 3 to 8The description of the steps executed by the terminal device (such as a mobile phone or a home storage device) in each embodiment is described in detail here for the sake of brevity.
[0232] Optionally, the communication unit 1120 may include a receiving unit (module) and a sending unit (module), which are used to perform the steps of receiving information and sending information by the terminal device in the aforementioned various method embodiments. The storage unit 1130 is used to store instructions executed by the processing unit 1110 and the communication unit 1120. The processing unit 1110, the communication unit 1120 and the storage unit 1130 are connected in communication, the storage unit 1130 stores instructions, the processing unit 1110 is used to execute the instructions stored in the storage unit, and the communication unit 1120 is used to perform specific signal transmission and reception under the drive of the processing unit 1110.
[0233] It should be understood that the communication unit 1120 may be a transceiver, an input / output interface or an interface circuit, etc., and may be composed of Fig.10 The wireless communication module 1050 in the illustrated embodiment is implemented. The storage unit may be a memory, for example, Fig.10 The external memory interface 1020 and the internal memory 1021 in the illustrated embodiment are implemented. The processing unit 1110 may be composed of Fig.10 In the illustrated embodiment, the processor 1010 may be implemented by the processor 1010 , the external memory interface 1020 , and the internal memory 1021 .
[0234] It should also be understood that Fig.11 The communication device 1100 shown may be a terminal device, or the terminal device may include Fig.11 The communication device 1100 is shown.
[0235] Fig.12 A schematic block diagram of another example of a communication device 1200 provided by the present application is shown. The communication device 1200 may correspond to the protocol configuration gateway or TURN server described in the above method implementation, or may be a chip or component applied to the protocol configuration gateway or TURN server, and each module or unit in the communication device 1200 is respectively used to execute each action or processing performed by the protocol configuration gateway or TURN server described in the above method example, such as Fig.12 As shown, the communication device 1200 may include: a processing unit 1210 and a communication unit 1220. Optionally, the communication device 1200 may also include a storage unit 1230.
[0236] It should be understood that the specific process of each unit in the communication device 1200 performing the above corresponding steps can be referred to in conjunction with the above Figure 4The descriptions of the steps for configuring a gateway or TURN server to execute as described in the various examples in the protocol section are not repeated here for the sake of brevity.
[0237] Optionally, the communication unit 1220 may include a receiving unit (module) and a sending unit (module) for executing the steps of configuring the gateway or TURN server and sending information in the aforementioned method examples. The storage unit 1230 is used to store instructions executed by the processing unit 1210 and the communication unit 1220. The processing unit 1210, the communication unit 1220 and the storage unit 1230 are connected in communication, the storage unit 1230 stores instructions, the processing unit 1210 is used to execute the instructions stored in the storage unit, and the communication unit 1220 is used to perform specific signal transmission and reception under the drive of the processing unit 1210.
[0238] It should be understood that the communication unit 1220 may be a transceiver, an input / output interface, or an interface circuit. The storage unit 1230 may be a memory. The processing unit 1210 may be implemented by a processor. Fig.13 As shown, the communication device 1300 may include a processor 1310 , a memory 1320 , and a transceiver 1330 .
[0239] Fig.12 The communication device 1200 or Fig.13 The communication device 1300 shown can implement the steps performed by the protocol configuration gateway or TURN server in the example of the aforementioned method 400. Similar descriptions can refer to the descriptions in the aforementioned corresponding methods. To avoid repetition, they will not be repeated here.
[0240] It should also be understood that Fig.12 The communication device 1200 or Fig.13 The communication device 1300 shown may be a protocol configuration gateway or a TURN server. Alternatively, the protocol configuration gateway or the TURN server may include Fig.12 The communication device 1200 or Fig.13 The communication device 1300 is shown.
[0241] The present application also provides a chip system, such as Fig.14As shown, the chip system includes at least one processor 1410 and at least one interface circuit 1420. The processor 1410 and the interface circuit 1420 can be interconnected via lines. For example, the interface circuit 1420 can be used to receive signals from other devices (such as terminal equipment, protocol configuration gateways, or TURN servers). For another example, the interface circuit 1420 can be used to send signals to other devices (such as processors 1410). Exemplarily, the interface circuit 1420 can read instructions stored in a memory and send the instructions to the processor 1410. When the instructions are executed by the processor 1410, the chip system can execute the various steps performed by the terminal device (such as a mobile phone or a home storage device), the protocol configuration gateway, or the TURN server in the above example. Of course, the chip system can also include other discrete devices, which are not specifically limited in this application.
[0242] It should also be understood that the division of units in the above device is only a division of logical functions. In actual implementation, they can be fully or partially integrated into one physical entity, or they can be physically separated. And the units in the device can all be implemented in the form of software calling through processing elements; they can also be all implemented in the form of hardware; some units can also be implemented in the form of software calling through processing elements, and some units can be implemented in the form of hardware. For example, each unit can be a separately established processing element, or it can be integrated in a certain chip of the device. In addition, it can also be stored in the memory in the form of a program, and called and executed by a certain processing element of the device. The processing element here can also be called a processor, which can be an integrated circuit with signal processing capabilities. In the implementation process, each step of the above method or each unit above can be implemented by an integrated logic circuit of hardware in the processor element or in the form of software calling through a processing element. In one example, the unit in any of the above devices may be one or more integrated circuits configured to implement the above method, such as one or more application specific integrated circuits (ASIC), or one or more digital signal processors (DSP), or one or more field programmable gate arrays (FPGA), or a combination of at least two of these integrated circuit forms. For another example, when the unit in the device can be implemented in the form of a processing element scheduler, the processing element can be a general-purpose processor, such as a central processing unit (CPU) or other processor that can call a program. For another example, these units can be integrated together and implemented in the form of a system-on-a-chip (SOC).
[0243] The embodiment of the present application also provides a device, which is included in a terminal device, a protocol configuration gateway or a TURN server, and the device has the function of implementing the terminal device, the protocol configuration gateway or the TURN server in any of the methods in the above embodiments. The function can be implemented by hardware, or the corresponding software can be implemented by hardware. The hardware or software includes at least one module or unit corresponding to the above function. For example, a display module or unit, a determination module or unit, a calculation module or unit, a sending module or unit, a receiving module or unit, etc.
[0244] The embodiment of the present application also provides a computer-readable storage medium for storing computer program code, the computer program including instructions for executing any one of the data transmission methods provided in the above embodiment of the present application. The readable medium may be a read-only memory (ROM) or a random access memory (RAM), which is not limited in the embodiment of the present application.
[0245] The present application also provides a computer program product, which includes instructions. When the instructions are executed, the terminal and the server perform corresponding operations in the above-mentioned data transmission method.
[0246] The embodiment of the present application also provides a chip located in a communication device, the chip comprising: a processing unit and a communication unit, the processing unit, for example, may be a processor, the communication unit, for example, may be an input / output interface, a pin or a circuit, etc. The processing unit may execute computer instructions to enable the communication device to execute any one of the data transmission methods provided in the embodiment of the present application.
[0247] Optionally, the computer instructions are stored in a storage unit.
[0248] Optionally, the storage unit is a storage unit within the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip within the terminal, such as a ROM or other types of static storage devices that can store static information and instructions, random RAM, etc. Among them, the processor mentioned in any of the above can be a CPU, a microprocessor, an ASIC, or one or more integrated circuits for controlling the execution of the program of the above-mentioned feedback information transmission method. The processing unit and the storage unit can be decoupled and respectively set on different physical devices, and connected by wired or wireless means to implement the respective functions of the processing unit and the storage unit to support the system chip to implement the various functions in the above-mentioned embodiments. Alternatively, the processing unit and the memory can also be coupled on the same device.
[0249] Among them, the terminal device, protocol configuration gateway, TURN server, computer-readable storage medium, computer program product or chip provided in this embodiment are all used to execute the corresponding methods provided above. Therefore, the beneficial effects that can be achieved can refer to the beneficial effects in the corresponding methods provided above, and will not be repeated here.
[0250] It is understood that the memory in the embodiment of the present application can be a volatile memory or a non-volatile memory, or can include both volatile and non-volatile memories. Among them, the non-volatile memory can be a ROM, a programmable read-only memory (programmable ROM, PROM), an erasable programmable read-only memory (erasable PROM, EPROM), an electrically erasable programmable read-only memory (electrically EPROM, EEPROM) or a flash memory. The volatile memory can be a RAM, which is used as an external cache. There are many different types of RAM, such as static random access memory (static RAM, SRAM), dynamic random access memory (dynamic RAM, DRAM), synchronous dynamic random access memory (synchronous DRAM, SDRAM), double data rate synchronous dynamic random access memory (double data rate SDRAM, DDR SDRAM), enhanced synchronous dynamic random access memory (enhanced SDRAM, ESDRAM), synchronous connection dynamic random access memory (synch link DRAM, SLDRAM) and direct memory bus random access memory (direct rambus RAM, DRRAM).
[0251] Various objects such as various messages / information / equipment / network elements / systems / devices / actions / operations / processes / concepts that may appear in this application are named. It can be understood that these specific names do not constitute a limitation on the relevant objects. The names assigned may change with factors such as scenarios, contexts or usage habits. The understanding of the technical meaning of the technical terms in this application should be mainly determined from the functions and technical effects embodied / executed in the technical scheme.
[0252] In the various embodiments of the present application, unless otherwise specified or provided for in any logical conflict, the terms and / or descriptions between the different embodiments are consistent and may be referenced to each other, and the technical features in the different embodiments may be combined to form new embodiments according to their inherent logical relationships.
[0253] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0254] The method in the embodiment of the present application can be implemented in whole or in part by software, hardware, firmware or any combination thereof. When implemented using software, it can be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer programs or instructions. When the computer program or instruction is loaded and executed on a computer, the process or function described in the embodiment of the present application is executed in whole or in part. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer program or instruction can be stored in a computer-readable storage medium or transmitted via the computer-readable storage medium. The computer-readable storage medium can be any available medium that a computer can access or a data storage device such as a server that integrates one or more available media.
[0255] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.
[0256] In the several embodiments provided in the present application, it should be understood that the disclosed systems, devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0257] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0258] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.
[0259] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a readable storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned readable storage medium includes: various media that can store program codes, such as USB flash drives, mobile hard drives, ROM, RAM, magnetic disks, or optical disks.
[0260] The above is only a specific implementation of the present application, but the protection scope of the present application is not limited thereto. Any person skilled in the art who is familiar with the present technical field can easily think of changes or substitutions within the technical scope disclosed in the present application, which should be included in the protection scope of the present application. Therefore, the protection scope of the present application should be based on the protection scope of the claims.
Claims
1. A data transmission system, characterized in that: The system includes: a first terminal device, a TURN server and a second terminal device: The first terminal device and the second terminal device establish a transmission channel based on the TURN protocol, wherein the transmission channel based on the TURN protocol is a transmission channel using the TURN server as a transit; In the transmission channel, the first terminal device sends the data to be transmitted to the TURN server based on the KCP protocol and using KCP protocol parameters, where the KCP protocol parameters are determined according to the service type and service scenario corresponding to the data to be transmitted; In the transmission channel, the second terminal device receives the data to be transmitted from the TURN server based on the KCP protocol and using the KCP protocol parameters.
2. The system according to claim 1, characterized in that In the transmission channel, the TURN server receives the data to be transmitted from the first terminal device using a first bandwidth threshold, where the first bandwidth threshold is determined according to a service type and a service scenario corresponding to the data to be transmitted, and the data to be transmitted includes: service type information and service scenario information corresponding to the data to be transmitted; In the transmission channel, the TURN server sends the data to be transmitted to the second terminal device using the first bandwidth threshold.
3. The system according to claim 1 or 2, characterized in that: The system further includes: a protocol configuration gateway, and the first terminal device and the second terminal device respectively establish a long connection communication with the protocol configuration gateway: The protocol configuration gateway receives service type information and service scenario information corresponding to the data to be transmitted sent by the first terminal device and / or the second terminal device; The protocol configuration gateway determines at least one of the first bandwidth threshold and the KCP protocol parameter according to the service type information and service scenario information corresponding to the data to be transmitted; The protocol configuration gateway sends the first bandwidth threshold and the service type information and service scenario information corresponding to the data to be transmitted to the TURN server, and / or the protocol configuration gateway sends the KCP protocol parameters to the first terminal device and the second terminal device respectively.
4. The system according to any one of claims 1 to 3, characterized in that: The system further includes: a protocol configuration gateway, and the first terminal device and the second terminal device respectively establish a long connection communication with the protocol configuration gateway: The first terminal device obtains a public network IP address and a port number allocated to the first terminal device from the TURN server; The first terminal device sends the public IP address and port number of the first terminal device to the protocol configuration gateway; The second terminal device receives the public IP address and port number of the first terminal device sent by the protocol configuration gateway; The second terminal device obtains the public IP address and port number allocated to the second terminal device from the TURN server; The second terminal device sends the public IP address and port number of the second terminal device to the protocol configuration gateway; The first terminal device receives the public IP address and port number of the second terminal device sent by the protocol configuration gateway.
5. The system according to claim 4, characterized in that The first terminal device uses the public IP address and port number of the second terminal device to establish the TURN protocol-based transmission channel with the second terminal device.
6. The system according to any one of claims 1 to 5, characterized in that The KCP protocol parameters include at least one of the following parameters: The value of the maximum transmission unit of the KCP protocol, the value of the receiving window of the KCP protocol, the value of the sending window of the KCP protocol, and the indication information of whether the flow control switch is turned on.
7. The system according to any one of claims 1 to 6, characterized in that: The first terminal device or the second terminal device is a home storage device.
8. The system according to any one of claims 1 to 7, characterized in that The data to be transmitted includes: at least one of pictures, audio, video, or text information, and the data to be transmitted is related to the business scenario.
9. The system according to claim 8, characterized in that The value of the KCP protocol parameter corresponding to the picture is different from the value of the KCP protocol parameter corresponding to the audio or video.
10. The system according to any one of claims 1 to 9, characterized in that The second terminal device has a first application installed thereon, where the first application is related to the service type.
11. A method for data transmission, characterized in that: The method comprises: The first terminal device and the second terminal device establish a transmission channel based on the TURN protocol, wherein the transmission channel based on the TURN protocol is a transmission channel using a TURN server as a transfer; In the transmission channel, the first terminal device sends the data to be transmitted to the TURN server based on the KCP protocol and using KCP protocol parameters, where the KCP protocol parameters are determined according to the service type and service scenario corresponding to the data to be transmitted.
12. The method according to claim 11, characterized in that The method further comprises: The first terminal device sends the service type information and service scenario information corresponding to the data to be transmitted to the protocol configuration gateway, and the first terminal device and the protocol configuration gateway establish a long connection communication; The first terminal device receives the KCP protocol parameters sent by the protocol configuration gateway.
13. The method according to claim 11 or 12, characterized in that: The method further comprises: The first terminal device obtains a public network IP address and a port number allocated to the first terminal device from the TURN server; The first terminal device sends the public IP address and port number of the first terminal device to the protocol configuration gateway, and the first terminal device and the protocol configuration gateway establish a long connection communication; The first terminal device receives the public IP address and port number of the second terminal device sent by the protocol configuration gateway.
14. The method according to claim 13, characterized in that The first terminal device and the second terminal device establish a transmission channel based on the TURN protocol, including: The first terminal device uses the public IP address and port number of the second terminal device to establish the TURN protocol-based transmission channel with the second terminal device.
15. The method according to any one of claims 11 to 14, characterized in that The KCP protocol parameters include at least one of the following parameters: The value of the maximum transmission unit of the KCP protocol, the value of the receiving window of the KCP protocol, the value of the sending window of the KCP protocol, and the indication information of whether the flow control switch is turned on.
16. The method according to any one of claims 11 to 15, characterized in that The first terminal device is a home storage device.
17. The method according to any one of claims 11 to 16, characterized in that The data to be transmitted includes: at least one of pictures, audio, video, or text information, and the data to be transmitted is related to the business scenario.
18. The method according to claim 17, characterized in that The value of the KCP protocol parameter corresponding to the picture is different from the value of the KCP protocol parameter corresponding to the audio or video.
19. A method for data transmission, characterized in that: The method comprises: The second terminal device and the first terminal device establish a transmission channel based on the TURN protocol, wherein the transmission channel based on the TURN protocol is a transmission channel using a TURN server as a transfer; In the transmission channel, the second terminal device receives the data to be transmitted from the TURN server based on the KCP protocol and using KCP protocol parameters, and the KCP protocol parameters are determined according to the service type and service scenario corresponding to the data to be transmitted.
20. The method according to claim 19, characterized in that The method further comprises: The second terminal device sends the service type information and service scenario information corresponding to the data to be transmitted to the protocol configuration gateway, and the second terminal device and the protocol configuration gateway establish a long connection communication; The second terminal device receives the KCP protocol parameters sent by the protocol configuration gateway.
21. The method according to claim 19 or 20, characterized in that: The method further comprises: The second terminal device obtains the public IP address and port number allocated to the first terminal device from the TURN server; The second terminal device sends the public IP address and port number of the second terminal device to the protocol configuration gateway, and the second terminal device and the protocol configuration gateway establish a long connection communication; The second terminal device receives the public IP address and port number of the first terminal device sent by the protocol configuration gateway.
22. The method according to claim 21, characterized in that The second terminal device and the first terminal device establish a transmission channel based on the TURN protocol, including: The second terminal device uses the public IP address and port number of the first terminal device to establish the TURN protocol-based transmission channel with the first terminal device.
23. The method according to any one of claims 19 to 22, characterized in that The KCP protocol parameters include at least one of the following parameters: The value of the maximum transmission unit of the KCP protocol, the value of the receiving window of the KCP protocol, the value of the sending window of the KCP protocol, and the indication information of whether the flow control switch is turned on.
24. The method according to any one of claims 19 to 23, characterized in that: The second terminal device is a home storage device.
25. The method according to any one of claims 19 to 24, characterized in that The data to be transmitted includes: at least one of pictures, audio, video, or text information, and the data to be transmitted is related to the business scenario.
26. The method according to claim 25, characterized in that The value of the KCP protocol parameter corresponding to the picture is different from the value of the KCP protocol parameter corresponding to the audio or video.
27. The method according to any one of claims 19 to 26, characterized in that The second terminal device has a first application installed thereon, where the first application is related to the service type.
28. A terminal device, characterized in that: include: Processor and memory; The processor is coupled to a memory, wherein the memory stores program instructions. When the program instructions stored in the memory are executed by the processor, the method according to any one of claims 11 to 18 or the method according to any one of claims 19 to 27 is performed.
29. A computer-readable storage medium, characterized in that: A computer program is stored in the computer-readable storage medium, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to execute: the method according to any one of claims 11 to 18, or the method according to any one of claims 19 to 27.
30. A chip, characterized in that: It comprises: a processor, configured to call and run a computer program from a memory, so that a communication device equipped with the chip executes: a method as claimed in any one of claims 11 to 18, or a method as claimed in any one of claims 19 to 27.
Citation Information
Cited By
Large file transmission system based on low-broadband scene of mobile terminal
CN121262205A