Data transmission method, system and device, electronic equipment and computer program product
By designing a data transmission method on the UDP protocol, using connections to establish a confirmation signaling and a confirmation character tag array, combined with Protobuf serialization, the problem of TCP performance cost and insufficient UDP reliability is solved, and fast and reliable data transmission and service are achieved. Quality evaluation.
Patent Information
- Application Number
- CN202411237786.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-04
- Publication Date
- 2024-12-13
AI Technical Summary
The existing TCP protocol has performance costs in network communication scenarios with high real-time requirements, and the UDP protocol lacks a reliability mechanism, making it difficult to achieve fast and reliable data transmission.
By designing a data transmission method based on the UDP protocol, using connections to establish a confirmation signaling and a confirmation character marking array, double-ended communication connection and quality evaluation are realized, and data serialization is combined with Protobuf to optimize the data transmission process.
It realizes fast, low latency and reliable data transmission, reduces transmission costs and network latency impacts, maintains high transmission quality in complex environments, and provides service quality evaluation.
Smart Images

Figure CN119135744A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of network communication technology, and in particular to a data transmission method, a data transmission system, a data transmission device, an electronic device, and a computer program product. Background Art
[0002] In network communication scenarios, data transmission between most clients and servers usually relies on the Transmission Control Protocol (TCP). However, the TCP protocol has many problems in such scenarios with high real-time requirements. The traditional TCP protocol pays a performance price in the data transmission process due to its reliability and stability. First, TCP needs to establish a connection before transmitting data, which will consume a certain amount of time. In addition, during the data transmission process, TCP's confirmation mechanism, retransmission mechanism, and congestion control may cause additional time consumption. Secondly, TCP's confirmation mechanism and three-way handshake process make it easy to become a target of attack, which has a certain impact on security.
[0003] In contrast, the User Datagram Protocol (UDP) is a connectionless, stateless transmission protocol with a relatively fast transmission speed. However, simply encapsulating the data at the protocol level based on the UDP protocol may bring some problems, such as when to transmit data, how to process data, how to evaluate quality information, etc. Therefore, it is also necessary to implement a reliable mechanism similar to TCP based on UDP and perform a series of designs and modifications at the application layer, so as to maintain the high-speed transmission characteristics of UDP and provide a certain degree of transmission reliability, thereby achieving fast and relatively reliable stable data transmission. Summary of the invention
[0004] The present disclosure provides a data transmission method, system, device, electronic device, computer-readable storage medium and computer program product, so as to at least solve the problem that the related art cannot simultaneously integrate the real-time, low-latency and flexible customization of UDP and the characteristics of TCP to ensure reliable delivery, and lacks a high-efficiency, low-overhead and high-reliability data transmission solution. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a data transmission method is provided, which is applied to a server, and the method includes: based on a connection establishment request received from a client, sending a connection establishment confirmation signaling to the client, the connection establishment confirmation signaling is used to establish a two-way communication connection; based on a data request sent by the client, determining request response data, and sending the request response data to the client; receiving a confirmation character tag array returned by the client, the confirmation character tag array is generated based on the request response data received by the client; and according to the confirmation character tag array, determining a quality evaluation index for this data transmission.
[0006] In an exemplary embodiment of the present disclosure, the sending of a connection establishment confirmation signaling to the client based on a connection establishment request received from the client includes: receiving a connection establishment request sent by the client, the connection establishment request including a client device identifier of the client; determining a first network address and a first network port of the client based on the connection establishment request, and saving the client device identifier; sending the connection establishment confirmation signaling to the client to establish a two-end communication connection, the connection establishment confirmation signaling including a server device identifier and the client device identifier.
[0007] In an exemplary embodiment of the present disclosure, determining the request response data based on the data request sent by the client includes: determining the request response data according to the data request, the request content of the data request including one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; the data request identifier is obtained based on a hash calculation of a combined text of a server device identifier of the server, the request file starting position, and the request file size.
[0008] In an exemplary embodiment of the present disclosure, determining the request response data according to the data request includes: determining a request file according to the data request; performing file splitting processing on the request file according to a maximum transmission unit to obtain segmented file data; and encapsulating a plurality of the segmented file data into data response packets respectively to obtain the request response data.
[0009] In an exemplary embodiment of the present disclosure, the multiple segmented file data are respectively encapsulated into data response packets to obtain the request response data, including: determining the key fields of the data response packet, the key fields including one or more of a request packet offset, a data request identifier, a data connection identifier, and an answer reply confirmation signaling; based on the key fields and the segmented file data, generating the data response packet.
[0010] In an exemplary embodiment of the present disclosure, determining the quality evaluation index of this data transmission based on the confirmation character mark array includes: in response to receiving the last confirmation signaling of the data request, traversing the confirmation character mark array, and summarizing the quality evaluation related data of the data request; determining the quality evaluation index of this data transmission based on the quality evaluation related data.
[0011] In an exemplary embodiment of the present disclosure, determining the quality evaluation index of this data transmission based on the confirmation character mark array also includes: based on a pre-configured timing task, regularly executing connection and request check operations to obtain a request timeout result of the data request; when the request timeout result is greater than the pre-configured timeout time, summarizing quality evaluation related data of the data request according to the confirmation character mark array; and determining the quality evaluation index of this data transmission based on the quality evaluation related data.
[0012] In an exemplary embodiment of the present disclosure, determining the quality evaluation index of this data transmission based on the quality evaluation related data includes: determining the number of packet losses and the total number of data packets based on the quality evaluation related data; determining the data packet loss rate based on the number of packet losses and the total number of data packets; determining the number of received confirmation packets and the number of confirmation reply packets, and determining the data confirmation rate based on the number of confirmation packets and the number of confirmation reply packets; obtaining the reply packet timestamp of the confirmation reply packet, and determining the data round-trip delay based on the current timestamp and the reply packet timestamp.
[0013] According to a second aspect of an embodiment of the present disclosure, a data transmission method is provided, which is applied to a client, and the method includes: sending a connection establishment request to a server, receiving a connection establishment confirmation signaling returned by the server, wherein the connection establishment confirmation signaling is used to establish a two-way communication connection; sending a data request to the server, receiving request response data returned by the server based on the data request; generating a confirmation character mark array based on the received request response data, and sending the confirmation character mark array to the server, wherein the confirmation character mark array is used to determine a quality evaluation index for this data transmission.
[0014] In an exemplary embodiment of the present disclosure, sending a connection establishment request to a server and receiving a connection establishment confirmation signaling returned by the server include: obtaining a server address of the server, wherein the server address includes a second network address and a second network port; sending the connection establishment request to the server based on the server address, wherein the connection establishment request includes a client device identifier; and receiving the connection establishment confirmation signaling returned by the server, wherein the connection establishment confirmation signaling includes a server device identifier and the client device identifier.
[0015] In an exemplary embodiment of the present disclosure, sending a data request to the server includes: determining the request content of the data request, the request content including one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; generating the data request based on the request content, and sending the data request to the server; the data request identifier is obtained by performing a hash calculation on a combined text of a server device identifier, a request file starting position, and a request file size.
[0016] In an exemplary embodiment of the present disclosure, the request response data includes a data response packet, and the generation of a confirmation character tag array based on the received request response data includes: determining an answer reply confirmation signaling according to the received request response data; determining a reception result of the data response packet, and updating a confirmation character tag array according to the reception result; generating a confirmation character signaling according to the answer reply confirmation signaling and the confirmation character tag array, the confirmation character signaling including one or more of a data request identifier, a data connection identifier, a request packet offset, the confirmation character tag array, and a reply packet timestamp; and sending the confirmation character signaling to the server.
[0017] According to a third aspect of an embodiment of the present disclosure, there is provided a data transmission system, comprising: a client, configured to send a connection establishment request to a server, and receive a connection establishment confirmation signaling returned by the server based on the connection establishment request; the server, configured to send the connection establishment confirmation signaling to the client according to the connection establishment request, so as to establish a two-way communication connection; the client, further configured to send a data request to the server, receive request response data determined by the server based on the data request, and generate a confirmation character tag array according to the received request response data; the server, further configured to determine a quality evaluation index for this data transmission according to the confirmation character tag array.
[0018] According to a fourth aspect of an embodiment of the present disclosure, there is provided a data transmission device, which is applied to a server, and the device comprises: a first connection establishment module, which is used to send a connection establishment confirmation signaling to the client based on a connection establishment request received from the client, and the connection establishment confirmation signaling is used to establish a two-end communication connection; a data sending module, which is used to determine request response data based on the data request sent by the client, and send the request response data to the client; a confirmation array receiving module, which is used to receive a confirmation character mark array returned by the client, and the confirmation character mark array is generated based on the request response data received by the client; and a quality evaluation module, which is used to determine a quality evaluation index of this data transmission according to the confirmation character mark array.
[0019] In an exemplary embodiment of the present disclosure, the first connection establishment module includes a first connection establishment unit, which is used to: receive a connection establishment request sent by the client, the connection establishment request including a client device identifier of the client; based on the connection establishment request, determine a first network address and a first network port of the client, and save the client device identifier; send the connection establishment confirmation signaling to the client to establish a two-end communication connection, the connection establishment confirmation signaling including a server device identifier and the client device identifier.
[0020] In an exemplary embodiment of the present disclosure, the data sending module includes a data determination unit, which is used to: determine the request response data according to the data request, the request content of the data request includes one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; the data request identifier is obtained based on a hash calculation of a combined text of a server device identifier of the server, the request file starting position and the request file size.
[0021] In an exemplary embodiment of the present disclosure, the data determination unit includes a data determination sub-unit, which is used to: determine the request file according to the data request; perform file splitting processing on the request file according to the maximum transmission unit to obtain segmented file data; and encapsulate multiple segmented file data into data response packets respectively to obtain the request response data.
[0022] In an exemplary embodiment of the present disclosure, the data determination subunit is configured to perform: determining the key fields of the data response packet, the key fields including one or more of a request packet offset, a data request identifier, a data connection identifier, and an answer reply confirmation signaling; generating the data response packet based on the key fields and the segmented file data.
[0023] In an exemplary embodiment of the present disclosure, the quality evaluation module includes a first quality evaluation unit, which is used to: in response to receiving the last confirmation signaling of the data request, traverse the confirmation character tag array, and summarize the quality evaluation related data of the data request; determine the quality evaluation index of this data transmission based on the quality evaluation related data.
[0024] In an exemplary embodiment of the present disclosure, the quality evaluation module also includes a second quality evaluation unit, which is used to: based on a pre-configured timing task, regularly execute connection and request check operations to obtain a request timeout result of the data request; when the request timeout result is greater than the pre-configured timeout period, summarize the quality evaluation related data of the data request according to the confirmation character mark array; and determine the quality evaluation index of this data transmission based on the quality evaluation related data.
[0025] In an exemplary embodiment of the present disclosure, the quality evaluation module also includes a quality evaluation subunit, which is used to: determine the number of packet losses and the total number of data packets based on the quality evaluation related data; determine the data packet loss rate based on the number of packet losses and the total number of data packets; determine the number of received confirmation packets and the number of confirmation reply packets, and determine the data confirmation rate based on the number of confirmation packets and the number of confirmation reply packets; obtain the reply packet timestamp of the confirmation reply packet, and determine the data round-trip delay based on the current timestamp and the reply packet timestamp.
[0026] According to a fifth aspect of an embodiment of the present disclosure, there is provided a data transmission device, which is applied to a client, and the device comprises: a second connection establishment module, which is used to send a connection establishment request to a server, and receive a connection establishment confirmation signaling returned by the server, wherein the connection establishment confirmation signaling is used to establish a two-way communication connection; a data receiving module, which is used to send a data request to the server, and receive request response data returned by the server based on the data request; a confirmation array generation module, which is used to generate a confirmation character mark array based on the received request response data, and send the confirmation character mark array to the server, wherein the confirmation character mark array is used to determine a quality evaluation index for this data transmission.
[0027] In an exemplary embodiment of the present disclosure, the second connection establishment module includes a second connection establishment unit, which is used to: obtain the server address of the server, the server address includes a second network address and a second network port; send the connection establishment request to the server based on the server address, the connection establishment request includes a client device identifier; receive the connection establishment confirmation signaling returned by the server, the connection establishment confirmation signaling includes a server device identifier and the client device identifier.
[0028] In an exemplary embodiment of the present disclosure, the data receiving module includes a data receiving unit, which is used to: determine the request content of the data request, the request content including one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; generate the data request based on the request content, and send the data request to a server; the data request identifier is obtained by performing a hash calculation on a combined text of a server device identifier, a request file starting position, and a request file size.
[0029] In an exemplary embodiment of the present disclosure, the request response data includes a data response packet, and the confirmation array generation module includes a confirmation array generation unit, which is used to: determine an answer reply confirmation signaling according to the received request response data; determine a reception result of the data response packet, and update a confirmation character mark array according to the reception result; generate a confirmation character signaling according to the answer reply confirmation signaling and the confirmation character mark array, the confirmation character signaling including one or more of a data request identifier, a data connection identifier, a request packet offset, the confirmation character mark array, and a reply packet timestamp; and send the confirmation character signaling to the server.
[0030] According to a sixth aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute instructions to implement any one of the data transmission methods described above.
[0031] According to a seventh aspect of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device can execute any one of the data transmission methods described above.
[0032] According to an eighth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program, which implements any one of the above-mentioned data transmission methods when executed by a processor.
[0033] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0034] On the one hand, the two ends can be connected through the connection establishment request and connection establishment confirmation signaling, without the need for complex handshake and confirmation mechanisms, which can make full use of network bandwidth and resources, achieve faster transmission speeds, and have lower transmission costs. On the other hand, during data transmission, there is no need to enforce the orderliness of data, and it is not affected by network delays and packet loss, so it can maintain high transmission quality in complex and unstable network environments. On the other hand, through the confirmation character mark array returned by the client, the server can accurately evaluate the current service quality and network status of both ends.
[0035] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0037] Figure 1 It is a flowchart of the implementation of the TCP-based application layer protocol in the relevant scheme.
[0038] Figure 2 The figure is a flow chart showing the implementation of a UDP-based application layer protocol according to an exemplary embodiment.
[0039] Figure 3 The present invention is a flowchart of a data transmission method applied to a server according to an exemplary embodiment.
[0040] Figure 4 The figure is a schematic diagram of data transmission implemented by an application layer protocol based on UDP according to an exemplary embodiment.
[0041] Figure 5 The present invention is a flowchart of implementing establishing a connection between two ends according to an exemplary embodiment.
[0042] Figure 6 The diagram is a diagram of key fields of a data request sent by a client according to an exemplary embodiment.
[0043] Figure 7 The diagram is a diagram of key fields of a data response packet sent by a server according to an exemplary embodiment.
[0044] Figure 8 The diagram is a diagram of key fields of a confirmation character signaling replied by a client according to an exemplary embodiment.
[0045] Fig. 9 The figure is a flow chart of quality evaluation according to an exemplary embodiment.
[0046] Fig.10 The figure is a schematic diagram showing calculation of data packet loss rate and ACK rate according to an exemplary embodiment.
[0047] Fig.11 It is a schematic diagram showing the change of bandwidth information of TCP data transmission and the data transmission scheme of the present disclosure according to an exemplary embodiment.
[0048] Fig.12It is a comparison diagram of packet loss data and TCP retransmission rate of a data transmission solution according to an exemplary embodiment.
[0049] Fig.13 It is a comparison diagram of the average RTT of UDP and the average RTT of TCP in a data transmission scheme according to an exemplary embodiment.
[0050] Fig.14 The present invention is a flowchart showing a data transmission method applied to a client according to an exemplary embodiment.
[0051] Fig.15 The present invention is a block diagram showing a data transmission device applied to a server according to an exemplary embodiment.
[0052] Fig.16 The invention is a block diagram showing a data transmission device applied to a client according to an exemplary embodiment.
[0053] Fig.17 A block diagram of an electronic device according to an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0054] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0055] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0056] In most data transmission scenarios, the client and server communicate by using TCP as the transport layer protocol, encapsulating it at the application layer, and then transmitting the data. Figure 1 As shown, Figure 1This is a flowchart of the implementation of the TCP-based application layer protocol in the relevant solution. After processing the data at the application layer, the self-designed Hypertext Transfer Protocol (HTTP) interface or the function in the HTTP library is called, and finally the TCP socket is called to complete the data transmission, and the data is sent to the network through the kernel layer or the driver layer. The reason why most of them use TCP for encapsulation is due to its reliable and stable characteristics. It has been widely used in most network data transmission scenarios, and there are a large number of mature and stable encapsulation libraries, which are friendly to developers. However, it is precisely because of its high reliability and strong encapsulation that it also brings many problems, and has certain limitations for customized operations in specific scenarios.
[0057] First of all, the TCP transmission protocol itself has some shortcomings. For example, the number of TCP header bytes can be as high as 60 bytes, and the header overhead is large. In order to meet point-to-point communication, TCP needs to establish a large number of connections, and each connection requires three handshakes and four waves to establish and destroy. After each TCP packet is sent, the other end needs to reply with ACK information to ensure retransmission and reliability. When packet loss occurs, it is necessary to wait for retransmission, blocking all requests in the connection. When TCP starts to send data, the initial window is small, the speed is slow, and the competitiveness is not strong in the initial stage. When the network is congested, TCP's sliding window and congestion control will cause a significant window reduction, reduce the sending rate, and the window increase is relatively slow. Mechanisms such as congestion control and flow control will also introduce certain delays and additional overhead, and the transmission efficiency is relatively low.
[0058] Secondly, in many two-end communication scenarios, there are a large number of clients and servers, which not only require the transmission cost to be as low as possible, but also require a large amount of data requests and replies to be completed in a very short time. Because there are a large number of backup servers, you can select servers with good service quality for connection and download. If the download fails or the packet loss is serious, you can quickly select other backup servers for download. In this case, using TCP transmission with high reliability will affect real-time performance and transmission cost. And when there are network mapping restrictions on both the client and the server, TCP's connection mechanism will also affect communication efficiency. Therefore, there is a lack of a relatively simple, fast, and highly reliable protocol to achieve data transmission in this scenario.
[0059] Based on this, according to the embodiments of the present disclosure, a data transmission method, a data transmission system, a data transmission device, an electronic device, a computer-readable storage medium, and a computer program product are proposed.
[0060] The data transmission method disclosed in the present invention is based on Figure 2 accomplish, Figure 2It is a flowchart of the implementation of the UDP-based application layer protocol according to an exemplary embodiment. It mainly includes the following steps: step S210, application layer data processing. Application layer data processing is related to specific business. It is mainly that the client needs to clarify the file information to be requested and send the key information to the server. The server needs to quickly find the corresponding file and reasonably divide it and reply to the client; step S220, application layer protocol encapsulation, signaling processing, mainly to select the data that must be sent to the other end, and then reasonably store and encapsulate it in the signaling; step S230, use data description language (Protocol Buffers, Protobuf) as the serialization and deserialization of the signaling and data of both ends, so that the data can maintain the minimum accurate storage state during network transmission; step S240, the serialized data is sent through the UDP socket (UDP Socket) sending interface constructed by both ends, and then in step S250, the interface of the kernel layer and the driver layer is called to finally enter the network.
[0061] The UDP protocol is widely used in various audio and video streaming media transmission scenarios. The real-time, low latency and flexible customization of UDP are more advantageous in CDN links. Although UDP transmission does not guarantee reliable delivery, in CDN or other scenarios with high requirements for real-time and high efficiency, a small amount of packet loss and retransmission are allowed, so UDP is a good choice and replacement. However, when applying UDP to these scenarios, a lot of reliability work needs to be implemented by itself, that is, the characteristics of TCP to ensure reliable delivery, which need to be properly implemented in the UDP upper layer according to business conditions. The present disclosure is based on UDP to make corresponding implementations at the application layer for CDN or other business scenarios with high real-time requirements, thereby achieving high-efficiency, low-overhead and high-reliability data transmission. Specifically, the present disclosure mainly describes the encapsulation of the application layer protocol, that is, the implementation process of step S220 in detail.
[0062] In this article, it is important to understand that the terms involved, such as Content Delivery Network (CDN), refer to an intelligent virtual network formed by servers distributed in various regions. These servers store a large number of data copies, so the servers can serve users nearby, meet user data requests, and provide faster and more stable services, thereby reducing the load pressure on the source station and reducing bandwidth costs.
[0063] TCP is a connection-oriented, reliable transport layer protocol, widely used in the Internet and local area networks. Its main features and functions include: connection-oriented, reliable transmission, flow control, congestion control, etc., and it is widely used in data transmission scenarios that require high reliability. UDP is a connectionless, simple transport layer protocol, widely used in network communication scenarios that require fast transmission and low latency. Compared with TCP, UDP provides a lighter-weight transmission method, but lacks certain reliability mechanisms, and is widely used in scenarios that require fast transmission and low latency.
[0064] Protobuf is a language-neutral, platform-neutral, and extensible serialized data format. It is designed to efficiently serialize structured data and is often used in communication protocols, data storage, and other scenarios. Quick UDP Internet Connections (QUIC) is a UDP-based transport layer protocol designed to improve the performance and security of network transmission. QUIC combines some features of TCP, Transport Layer Security (TLS), and HTTP / 2.0 to provide faster and more reliable Internet connections.
[0065] In addition, any number of elements in the drawings is for illustration and not limitation, and any naming is only for distinction and does not have any limiting meaning.
[0066] The principle and spirit of the present disclosure are explained in detail below with reference to several representative embodiments of the present disclosure.
[0067] first, Figure 3 is a flow chart of a data transmission method according to an exemplary embodiment, which is applied to a server, such as Figure 3 As shown, the server end for executing the data transmission method of the present disclosure may be a computer device, wherein the computer device described in the present disclosure may include mobile terminal devices such as mobile phones, tablet computers, laptop computers, PDAs, and fixed terminal devices such as desktop computers. The server end may also be a system including a computer device and a server, and is implemented through the interaction between the computer device and the server. Specifically, the following steps are included.
[0068] In step S310, based on the received connection establishment request of the client, a connection establishment confirmation signaling is sent to the client, where the connection establishment confirmation signaling is used to establish a two-end communication connection.
[0069] In an exemplary embodiment of the present disclosure, a connection establishment request (HELLO_REQ signaling) may be a request sent by a client when the client wants to establish a communication connection with a server. A connection establishment confirmation signaling (HELLO_RSP signaling) may be a confirmation signaling returned by the server to the client based on the received connection establishment request. A two-end communication connection may be a communication connection between a client and a server.
[0070] In the data transmission scenario, the client wants to obtain data from the server based on the communication connection established between the two ends. Figure 4 , Figure 4 It is a schematic diagram of data transmission implemented by an application layer protocol based on UDP according to an exemplary embodiment. In step S410, the client 410 sends a connection establishment request to the server 420, namely, a HELLO_REQ signaling, which contains the client's own user identification (UID). In step S420, after receiving the HELLO_REQ signaling sent by the client 410, the server 420 sends a HELLO_RSP signaling to the client 410, which contains the server's own uid and brings back the client's uid. After receiving the HELLO_RSP signaling sent by the server 420, the client 410 determines the validity, error code and other information of the server. If there is no error, it is deemed that the connection is successfully established. The client believes that the connection with the server has been established and has the ability to send and receive data, laying the foundation for subsequent data transmission.
[0071] In step S320, request response data is determined based on the data request sent by the client, and the request response data is sent to the client.
[0072] In an exemplary embodiment of the present disclosure, the data request may be a request sent by the client to the server when the client wants to obtain data from the server. The request response data may be a request file determined by the server according to the data request.
[0073] After the connection is established, the required data can be sent and received. Generally, the client will immediately send a data request after it believes that the connection is successfully established. Figure 4 In step S430, the client 410 sends a data request, which has a unique request identifier id. After receiving the DATA_REQ sent by the client, the server will find the requested file according to the DATA_REQ. In step S440, the server 420 returns data to the client 410, such as the request response data can be sent to the client using a DATA_RSP packet.
[0074] In step S330, a confirmation character tag array returned by the client is received, where the confirmation character tag array is generated based on the request response data received by the client.
[0075] In an exemplary embodiment of the present disclosure, an ACK (Acknowledge character) mark array may be a reply message that the client sends to the server after receiving data. The field of the array is in the format of a binary bitmap. If received, the position is set to 1, and if lost, it is set to 0.
[0076] When the client receives DATA_RSP, it determines whether the packet has been received and updates the ACK flag array field in the ACK signaling. Figure 4 When an ACK reply is required, the client updates the ACK tag array and sends the ACK tag array to the server in step S450.
[0077] In step S340, the quality evaluation index of the data transmission is determined according to the confirmation character mark array.
[0078] In an exemplary embodiment of the present disclosure, the quality evaluation index may be an evaluation index for evaluating the current service quality and network status of both ends in this data transmission. The quality evaluation index may provide important data basis for subsequent congestion control, overload protection, and detection of the maximum available bandwidth of the device.
[0079] Each time the server receives an ACK packet from the client, it can merge the ACK tag array to ensure that the last used ACK tag array is comprehensive. The data is sorted and calculated at the last ACK, and the calculation result will be used as the quality evaluation information. The quality evaluation is mainly implemented around ACK signaling. The packet loss rate and other quality evaluation indicators are calculated based on the ACK tag array in the ACK signaling, so that the subsequent flow control, congestion control and other protocol optimizations in the data transmission solution can be carried out on this basis.
[0080] According to the data transmission method in this example embodiment, on the one hand, a two-way connection can be established through a connection establishment request and a connection establishment confirmation signaling, without the need for a complex handshake and confirmation mechanism, and the network bandwidth and resources can be fully utilized to achieve a faster transmission speed and a lower transmission cost. On the other hand, during data transmission, there is no need to forcibly ensure the orderliness of the data, and it is not affected by network delays and packet loss, so high transmission quality can be maintained in a complex and unstable network environment. On the other hand, through the confirmation character mark array returned by the client, the server can accurately evaluate the current service quality and network status of both ends.
[0081] Next, the data transmission method in this exemplary embodiment will be further described.
[0082] In an exemplary embodiment of the present disclosure, for step S310, based on the connection establishment request received from the client, a connection establishment confirmation signaling is sent to the client, including: receiving a connection establishment request sent by the client, the connection establishment request includes a client device identifier of the client; based on the connection establishment request, determining a first network address and a first network port of the client, and saving the client device identifier; sending a connection establishment confirmation signaling to the client to establish a two-end communication connection, the connection establishment confirmation signaling includes a server device identifier and a client device identifier.
[0083] The client device identifier may be a device uid that uniquely identifies a client. The first network address may be a network address corresponding to the client. The first network port may be a network port corresponding to the client. The server device identifier may be a user identifier that uniquely identifies a server.
[0084] In order to complete the dual-end connection as quickly and accurately as possible, the present disclosure reduces the dual-end connection stage to two handshakes. The information carried by the signaling in the handshake does not contain any other redundant information except the basic version, signaling identifier, area type and other standard information. It only contains the unique identifier uid of the opposite device to distinguish the devices at both ends. For example, the HELLO_REQ signaling sent by the client to the server contains the client's own uid.
[0085] refer to Figure 5 , Figure 5 This is a flowchart of establishing a connection between two ends according to an exemplary embodiment. The party that actively initiates the connection (client 410) first obtains the Internet Protocol (IP) address and port of the party that passively establishes the connection (server 420) through a third-party server. If there is a Network Address Translation (NAT) address mapping on the other end, both ends need to perform address mapping first, connect through the third-party server, and use the third party to perform the connection operation to ensure that the other end can receive the packets sent by itself instead of being discarded by NAT.
[0086] In step S410, the client 410 sends a HELLO_REQ signaling to the server 420, which includes the client's own uid. After receiving the HELLO_REQ signaling from the client 410, the server 420 determines the client's first network address (external IP address) and first port address, and then identifies and saves the client's uid to determine the validity of the client and record the connected device for subsequent statistics.
[0087] In step S420, the server 420 sends a HELLO_RSP signaling to the client 410 according to the received HELLO_REQ signaling. The HELLO_RSP signaling includes the server's own uid and brings back the client's uid. The client receives the HELLO_RSP signaling sent by the server and determines the validity, error code and other information of the server. If there is no error, the connection is deemed to be successfully established. The client believes that the connection with the server has been established and has the ability to send and receive data.
[0088] Compared with TCP's three-way handshake connection establishment mechanism, after the protocol completes the connection establishment, the client will immediately send a data request, and will retry if the sending fails, without the need for a complex handshake and confirmation mechanism. At the same time, it is hoped that both ends can retain the connection for a period of time, and the UDP protocol does not have a sequence number and confirmation mechanism, and network data transmission does not need to strictly guarantee the order of data. Even if the server's reply packet is not received for some reason, the loss of resources is very small. Therefore, if the handshake is successful twice, it can be considered that both ends have the ability to transmit data, and can make full use of network bandwidth and resources to achieve faster transmission speeds.
[0089] In an exemplary embodiment of the present disclosure, for step S320, the request response data is determined based on the data request sent by the client, including: determining the request response data according to the data request, the request content of the data request includes one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; the data request identifier is obtained based on a hash calculation of a combined text of a server device identifier, a request file starting position, and a request file size of the server.
[0090] Among them, the request content may be the specific content contained in the data request. The data request identifier may be a unique identifier of a certain data request. The request file identifier may be a unique identifier of the file requested by this data request. The request file starting position may be the storage location of the requested file on the server. The request file size may be the file size of the requested file. The task type may be the specific task type corresponding to this data request. For example, the task type may be divided according to the specific type of the requested file. The network type may be the network type used by the data request, including a wireless network and a mobile communication network. The combined text may be a text obtained by combining the texts of multiple request contents.
[0091] After the connection between the client and the server is established, the required data can be sent and received. Generally, the client will immediately send a data request after it believes that the connection is successfully established. Since the data request DATA_REQ is a request for specific data, the DATA_REQ signaling contains more content. Figure 6is a diagram showing key fields of a data request sent by a client according to an exemplary embodiment. The DATA_REQ signaling includes a data request identifier, a request file identifier, a request file start position, a request file size, a task type, a network type, etc. And, Figure 6 The specific number of bits corresponding to each field is shown in the figure, such as request id (64 bits), file id (64 bits), requested file starting position (32 bits), area type (32 bits), requested file size (16 bits), requested file length (16 bits), task type (16 bits), network type (16 bits), etc.
[0092] For data requests sent by the client, each data request has a unique identifier, namely the request id, which is obtained by hashing the combined text of the peer device's uid (server uid), the starting position of the requested file, and the size. The request id can be used to manage the life cycle of each data request, distinguish the received data, and can also be used as an index to find the request.
[0093] In addition, the present disclosure uses Protobuf as the storage and exchange unit of signaling and data at both ends. Compared with JavaScript Object Notation (JSON) and Extensible Markup Language (XML), since Protobuf uses binary encoding, the data structure can be compressed smaller, with efficient encoding and decoding performance, reducing network transmission and storage overhead, and can be used in a variety of programming languages and platforms. New fields can be added without destroying existing codes and data, and it has good backward compatibility. The signaling in the technical solution and the information in the signaling are serialized and deserialized using Protobuf, and the operations are performed on the machines of both ends to ensure the best transmission performance in the network.
[0094] In an exemplary embodiment of the present disclosure, request response data is determined according to a data request, including: determining a request file according to the data request; performing file splitting processing on the request file according to a maximum transmission unit to obtain segmented file data; and encapsulating multiple segmented file data into data response packets respectively to obtain request response data.
[0095] The request file may be file data corresponding to the data request determined from the server. The file splitting process may be a process of splitting a large file into multiple small files. The segmented file data may be segmented files obtained after the request file is split. The data response packet may be a data packet returned by the server to the client based on the data request.
[0096] After the server receives the data request from the client, i.e., the DATA_REQ signaling, it will find the file requested by the client as the request file. The request file is then split and processed, for example, the request file is split and processed according to the size of the Maximum Transmission Unit (MTU), and is divided into several or dozens of segmented file data. Each segmented file data is encapsulated to obtain multiple DATA_RSP data response packets. The multiple data response packets after the segmented encapsulation of the request file are collectively used as the request response data, and the data is sent out. By splitting the request file and then transmitting it, during the data transmission process, there is no need to enforce the orderliness of the data, and it is not affected by network delays and packet loss, so it can maintain high transmission quality in complex and unstable network environments.
[0097] In an exemplary embodiment of the present disclosure, multiple segmented file data are respectively encapsulated into data response packets to obtain request response data, including: determining key fields of the data response packet, the key fields including one or more of a request packet offset, a data request identifier, a data connection identifier, and an answer reply confirmation signaling; and generating a data response packet based on the key fields and the segmented file data.
[0098] Among them, the key field may be a key field included in the data response packet. The request packet offset may be the offset (sequence number) of the current data response packet in this data request. The data request identifier may be an identifier used to uniquely identify a data request. The data connection identifier may be an identifier used to uniquely identify a two-end communication connection. The acknowledgement reply confirmation signaling (NeedACK) may be a signaling indicating whether the service end of this data request requires the client to reply to the ACK signaling.
[0099] The data response packet DATA_RSP returned by the server to the client is both a data response packet and a key packet for evaluating quality, so it contains a lot of key information. Figure 7 , Figure 7 This is a diagram of key fields of a data response packet sent by a server according to an exemplary embodiment. The key fields of DATA_REQ mainly include: server uid (64 bits), connection id (64 bits), request id (64 bits), data, request file start position (32 bits), request packet offset (32 bits), request file size (16 bits), request file length (16 bits), task type (16 bits), file type (16 bits), response reply confirmation signaling NeedACK (16 bits) and timestamp (64 bits), etc.
[0100] Specifically, some key fields are explained in detail as follows: (1) The request packet offset is the offset (sequence number) of the current data response packet in this data request.
[0101] (2) The request id is obtained by concatenating and hashing the text of the server's uid, the starting position and size of the requested file, etc. It is used to mark the unique identifier of this data request, which is the same as the request id in the DATA_REQ signaling. For both ends, this value can be used to maintain the life cycle of the request and distinguish the index of the request. Especially for the server, since it needs to process a large number of requests, the server can use the request id to manage the life cycle and index different data requests.
[0102] (3) The connection ID is calculated by the server through hashing based on the IP address and port address of the client. It is used to mark the unique identifier of a two-way communication connection. That is, the concept of "connection" is introduced on the server to manage requests and maintain the life cycle of requests, becoming the key middleman between the network layer and requests. After the two-way connection is successfully established, the signaling received by the server will first find the corresponding connection, then find the corresponding request under the connection, and then save and process the data information. This makes request management clearer and the protocol hierarchy more distinct. For example, one connection ID can correspond to multiple request IDs.
[0103] (4) The NeedACK field is used to identify whether the client needs to reply to the ACK signaling for this data request. The ACK method disclosed in the present invention is a segmented ACK, which is different from TCP, which requires the other end to reply to an ACK every time a packet is sent. This will cause problems such as reduced communication efficiency, bandwidth waste, and increased network congestion. In this embodiment, NeedACK is performed at a specific position of the data reply packet DATA_RSP sent by the server. The client receives DATA_RSP and determines this bit to decide whether to reply to the server with ACK signaling, thereby reducing network congestion. Compared with TCP's ACK mechanism, it will reduce data packet transmission by several times.
[0104] After determining the key fields of the data response packet, the key fields and the segmented file data to be encapsulated in the data response packet are encapsulated to obtain a data response packet, and the data response packet is sent to the client. By performing a handshake and connection operation in advance, the data transmission scheme disclosed in the present invention is qualified to download file segments at the same time as TCP and other protocols, thereby achieving the effect of multi-protocol download speed competition, improving transmission efficiency and quality, further improving user experience such as fluency, and reducing bandwidth costs.
[0105] In an exemplary embodiment of the present disclosure, for step S340, the quality evaluation index of this data transmission is determined according to the confirmation character mark array, including: in response to the last confirmation signaling received for the data request, traversing the confirmation character mark array, and summarizing the quality evaluation related data of the data request; determining the quality evaluation index of this data transmission according to the quality evaluation related data.
[0106] The last confirmation signaling may be the last ACK signaling received by the server in this data request. The quality evaluation related data may be related data used to evaluate the quality of the two-end communication connection.
[0107] Each time the client receives DATA_RSP, it will determine whether the data response packet has been received and update the ACK flag array field in the ACK signaling. This field is in the format of a bitmap. If received, the position is set to 1, and if lost, it is set to 0. The client determines whether it needs to reply ACK based on the NeedACK field in the received data response packet. For example, when the client determines that the NeedACK field is true, it needs to send ACK signaling; when it determines that the NeedACK field is fasle, it does not need to send ACK signaling. Figure 8 The following is a diagram of key fields of the confirmation character signaling replied by the client according to an exemplary embodiment. The fields contained in the ACK signaling include timestamp (64 bits), connection ID (64 bits), request ID (64 bits), ACK tag array, and request packet offset (32 bits).
[0108] When an ACK reply is required, the client updates the ACK tag array and brings back the request id, connection id, request packet offset, and timestamp brought by the server as is. Each time the server receives an ACK reply packet from the client, it merges the ACK tag array to ensure that the last ACK tag array used is comprehensive. At the last ACK, the data is sorted and calculated to summarize the quality evaluation related data of the data request; then, based on the summarized quality evaluation related data, the quality evaluation index of this data transmission is determined.
[0109] Fig. 9 It is a flowchart of quality evaluation according to an exemplary embodiment. The processing timing of ACK signaling processing can be divided into two parts, including event-driven and time-driven. The event-driven can be the last ACK received by the server for this request; the time-driven can be performed through a pre-configured global timer to determine whether a request timeout occurs. In the event-driven, in step S910, the server receives the ACK signaling. In step S920, the corresponding data connection and data request are found according to the connection id and the request id. In step S930, it is determined whether the last ACK signaling of this request is received.
[0110] Due to the adoption of the segmented ACK mechanism, after the last ACK signaling is received, in step S940, the quality evaluation index is summarized and calculated. The server will perform a summary calculation of the ACK data, traverse the ACK tag array to determine the quality evaluation related data, and then calculate the quality evaluation related data to obtain the quality evaluation index of this data transmission. By carrying important information in the ACK reply packet, the server can accurately evaluate the current service quality and network status of both ends, and provide important data basis for subsequent adjustment of the data transmission plan.
[0111] In an exemplary embodiment of the present disclosure, for step S340, the quality evaluation index of this data transmission is determined according to the confirmation character mark array, and it also includes: based on a pre-configured timing task, regularly executing connection and request check operations to obtain a request timeout result of the data request; when the request timeout result is greater than the pre-configured timeout time, summarizing quality evaluation related data of the data request according to the confirmation character mark array; and determining the quality evaluation index of this data transmission according to the quality evaluation related data.
[0112] The connection and request check operation may be a check operation for determining whether the data connection and the data request have timed out. The request timeout result may be a result of determining whether the data request has timed out. The timeout time may be a pre-configured time for determining whether the data request has timed out.
[0113] The present disclosure also provides another timing-driven quality evaluation scheme, which continues to refer to Fig. 9 In step S950, a timeout calculation is performed through a pre-configured global timer to achieve timing drive. In step S960, the server can check the connection and request regularly, and determine the timeout of the connection and request according to the given timeout time. In step S970, it is determined whether the connection and request exceed the timeout time. If the timeout time is exceeded, step S940 is executed to summarize and calculate the quality evaluation index. Through timing drive, a quality evaluation scheme for data transmission is also provided to accurately reflect the service quality and link status of two-way data transmission.
[0114] In an exemplary embodiment of the present disclosure, a quality evaluation index of this data transmission is determined based on quality evaluation related data, including: determining the number of packet losses and the total number of data packets based on the quality evaluation related data; determining the data packet loss rate based on the number of packet losses and the total number of data packets; determining the number of received confirmation packets and the number of confirmation reply packets, and determining the data confirmation rate based on the number of confirmation packets and the number of confirmation reply packets; obtaining the reply packet timestamp of the confirmation reply packet, and determining the data round-trip delay based on the current timestamp and the reply packet timestamp.
[0115] Among them, the number of packet loss can be the number of data packets lost in this data transmission. The total number of data packets can be the total number of data packets sent in this data transmission. The data packet loss rate can be the ratio of the number of data packets lost in this data transmission to the number of data groups sent. The number of confirmation packets can be the number of ACKs received by the server. The number of confirmation reply packets can be the number of NeedACKs sent by the server. The data confirmation rate can be the ratio of the number of confirmation packets to the number of confirmation reply packets. The confirmation reply packet can be an ACK reply packet. The reply packet timestamp can be the timestamp contained in the ACK reply packet. The round-trip time (RTT) of data refers to the time from the start of sending data by the sender to the time when the sender receives the confirmation from the receiver (the receiver sends the confirmation immediately after receiving the data).
[0116] For the UDP-based application layer protocol disclosed in this disclosure, the most serious quality problem is packet loss. The evaluation of this quality problem is divided into two parts: packet loss rate and ACK rate. The summary and calculation of packet loss rate and ACK rate are introduced in detail below. Regarding the setting of NeedACK on the server side, firstly, the number of packets in a single request is determined according to the size of the request, and then a reasonable NeedACK interval is divided according to the number of packets. NeedACK is set for the last few packets of the request to prevent the last packet from not being received.
[0117] First of all, according to the two opportunities mentioned above, it can be divided into the following two situations. One is that the last ACK of this request is received. At this time, the packet loss rate can be calculated based on the ACK tag array information in the last ACK reply packet of the request and the total number of packets sent for this request; the other situation is that the current request times out. At this time, the request is likely to not receive the last or several ACK reply packets. The request that lost the ACK reply packet is not counted in the number of packet losses because it is impossible to confirm whether the client has received it. Therefore, the packet loss rate is calculated based on the ACK tag array information of the last ACK reply packet received and the packet sequence number (request packet offset) of the last ACK reply packet received for the request.
[0118] refer to Fig.10 , Fig.10 FIG. 1 is a schematic diagram showing a method of calculating a data packet loss rate and an ACK rate according to an exemplary embodiment. Fig.10It can be seen that after the client receives the data response packet, it determines the number of packet loss in this data transmission and divides it by the total number of data packets sent by the data request to obtain the packet loss rate. For the data confirmation rate (ACK rate), the ACK rate in both cases is calculated based on the number of confirmation packets received (ACK number) and the number of confirmation reply packets (NeedACK number). The ACK rate is obtained by dividing the number of ACKs received by the number of NeedACKs. Assuming that NeedACK is performed every 5 packets and the last packet, the calculation is divided into two cases: the last few packets are lost and no packets are lost. Fig.10 The upper middle figure is a schematic diagram of the last few packets not being lost. If the last few packets are not lost, the calculated packet loss rate is 7÷28=25%, and the ACK rate is 4÷6=66%; Fig.10 The lower middle figure is a schematic diagram of the last few packets lost. If the last few packets are lost, the calculated packet loss rate is 5÷20=25%, and the ACK rate is 4÷6=66%.
[0119] In addition, the round-trip delay of the data can be obtained by subtracting the timestamp in the ACK reply packet from the current timestamp. By setting the NeedACK in the data reply packet and the client replying ACK method, and carrying important information in the ACK reply packet, the server can accurately evaluate the current service quality and network status of both ends, and also provide important data basis for subsequent congestion control, overload protection, and detection of the maximum available bandwidth of the device.
[0120] refer to Fig.11 , Fig.11 FIG. 1 is a schematic diagram showing a change in bandwidth information of a data transmission scheme according to an exemplary embodiment. Fig.11 It can be seen that the overall sending bandwidth based on UDP of the present disclosure is significantly lower than the sending bandwidth based on TCP. Fig.12 , Fig.12 : is a comparison chart of packet loss data and TCP retransmission rate of a data transmission scheme according to an exemplary embodiment. The packet loss rate and ACK rate based on UDP disclosed in the present invention are significantly lower than the TCP retransmission rate of data transmission based on TCP. Fig.13 , Fig.13 1 is a comparison diagram of the average RTT of UDP and the average RTT of TCP according to an exemplary embodiment of a data transmission scheme. The average RTT based on UDP of the present disclosure is significantly reduced compared to the average RTT based on TCP.
[0121] according to Figure 11-Figure 15It can be seen that after implementing the data transmission protocol disclosed in the present invention on the server machine, the same effect as TCP can be achieved. Data can be stably sent and received under the premise of similar running bandwidth, and the packet loss rate is stable below 3%, which is lower than the TCP retransmission rate and has a smaller RTT than TCP.
[0122] In summary, the data transmission method disclosed in the present invention sends a connection establishment confirmation signaling to the client based on the connection establishment request received from the client, and the connection establishment confirmation signaling is used to establish a two-end communication connection; determines the request response data based on the data request sent by the client, and sends the request response data to the client; receives the confirmation character tag array returned by the client, and the confirmation character tag array is generated based on the request response data received by the client; and determines the quality evaluation index of this data transmission according to the confirmation character tag array. On the one hand, a two-end connection can be achieved through a connection establishment request and a connection establishment confirmation signaling, without the need for a complex handshake and confirmation mechanism, and the network bandwidth and resources can be fully utilized to achieve a faster transmission speed and a lower transmission cost. On the other hand, during data transmission, there is no need to forcibly guarantee the orderliness of the data, and it is not affected by network delays and packet loss, so it can maintain high transmission quality in a complex and unstable network environment; in addition, by performing a handshake and connection establishment operation in advance, it has the qualifications to download file fragments at the same time like protocols such as TCP, so that the effect of multi-protocol download racing can be achieved, and transmission efficiency and quality can be improved. On the other hand, the data transmission scheme based on the UDP transmission protocol can be optimized and improved in various aspects based on this protocol in the future, so as to realize more flexible and diverse customized development. On the other hand, through the confirmation character mark array returned by the client, the server can accurately evaluate the current service quality and network status of both ends, and provide important data basis for subsequent congestion control, overload protection, and detection of the maximum available bandwidth of the device.
[0123] also, Fig.14 is a flowchart of a data transmission method according to an exemplary embodiment, which is applied to a client, such as Fig.14 As shown, the client may be a computer device, wherein the computer device described in the present disclosure may include a mobile terminal device and a fixed terminal device. Specifically, the following steps are included.
[0124] In step S1410, a connection establishment request is sent to the server, and a connection establishment confirmation signaling returned by the server is received. The connection establishment confirmation signaling is used to establish a two-way communication connection.
[0125] In an exemplary embodiment of the present disclosure, continue to refer to Figure 4In step S410, the client 410 sends a connection establishment request to the server 420 via the HELLO_REQ signaling. In step S420, after receiving the HELLO_REQ signaling sent by the client 410, the server 420 sends a HELLO_RSP signaling to the client 410. The HELLO_RSP signaling includes the server's own uid and brings back the client's uid. After receiving the HELLO_RSP signaling sent by the server 420, the client 410 determines the validity, error code and other information of the server. If there is no error, it is deemed that the connection is successfully established. The client believes that the connection with the server has been established and has the ability to send and receive data.
[0126] In step S1420, a data request is sent to the server, and request response data returned by the server based on the data request is received.
[0127] In an exemplary embodiment of the present disclosure, continue to refer to Figure 4 In step S430, the client 410 sends a data request, DATA_REQ signaling, to the server 420. In step S440, after receiving the DATA_REQ signaling from the client 410, the server 420 finds the requested file according to the DATA_REQ signaling, and returns the requested file to the client 410 as request response data through multiple DATA_RSP data response packets.
[0128] In step S1430, a confirmation character tag array is generated based on the received request response data, and the confirmation character tag array is sent to the server. The confirmation character tag array is used to determine the quality evaluation index of this data transmission.
[0129] In an exemplary embodiment of the present disclosure, upon receiving DATA_RSP, the client determines whether the packet is received and updates the ACK flag array field in the ACK signaling. Figure 4 When an ACK reply is required, the client updates the ACK tag array and sends the ACK tag array to the server in step S450. Each time the server receives an ACK reply packet from the client, it can merge the ACK tag array to ensure that the last used ACK tag array is comprehensive. The data is sorted and calculated at the last ACK, and the calculation result will be used as quality evaluation information. Quality evaluation is mainly implemented around ACK signaling. Quality evaluation indicators such as packet loss rate are calculated based on the ACK tag array in the ACK signaling, so that subsequent optimization of protocols such as flow control and congestion control in the data transmission solution can be carried out on this basis.
[0130] According to the data transmission method in this example embodiment, on the one hand, a two-end connection can be established through a connection establishment request and a connection establishment confirmation signaling, without a complicated handshake and confirmation mechanism, which can fully utilize network bandwidth and resources, achieve faster transmission speed, and have lower transmission costs. On the other hand, through the confirmation character mark array returned by the client, the server can accurately evaluate the current service quality and network status of the two ends.
[0131] Next, the data transmission method in this exemplary embodiment will be further described.
[0132] In an exemplary embodiment of the present disclosure, for step S1410, a connection establishment request is sent to the server, and a connection establishment confirmation signaling returned by the server is received, including: obtaining a server address of the server, the server address including a second network address and a second network port; sending a connection establishment request to the server based on the server address, the connection establishment request including a client device identifier; receiving a connection establishment confirmation signaling returned by the server, the connection establishment confirmation signaling including a server device identifier and a client device identifier.
[0133] The server address may be a network address and a port address corresponding to the server. The second network address may be a network address corresponding to the server. The second network port may be a network port corresponding to the server.
[0134] Continue to refer Figure 5 , the client 410 first obtains the IP address of the server 420 through a third-party server, and then sends a connection establishment request to the server based on the server address, namely, a HELLO_REQ signaling, which contains the client's own uid. After the server 420 receives the HELLO_REQ signaling sent by the client 410, it identifies and saves the client's uid to determine the validity of the client and record the device established.
[0135] In step S420, the server 420 sends a HELLO_RSP signaling to the client 410 according to the received HELLO_REQ signaling. The HELLO_RSP signaling contains the server's own uid and brings back the client's uid. The client receives the HELLO_RSP signaling sent by the server and determines the validity, error code and other information of the server. If there is no error, it is considered that the connection is successfully established. The client believes that the connection with the server has been established and has the ability to send and receive data. The rapid establishment of the two-end connection is completed through two handshakes, so that the two ends have the basic ability of data transmission, so that the network bandwidth and resources can be fully utilized to achieve a faster transmission speed.
[0136] In an exemplary embodiment of the present disclosure, for step S1420, sending a data request to the server includes: determining the request content of the data request, the request content including one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; generating a data request based on the request content, and sending the data request to the server; the data request identifier is obtained by performing a hash calculation on a combined text of a server device identifier, a request file starting position, and a request file size.
[0137] Before sending a data request, the client can first determine the request content of this data request, which may include but is not limited to one or more of the following: data request identifier, request file identifier, request file start position, request file size, task type, and network type. Then, a hash calculation is performed on the combined text of the server device identifier, request file start position, and request file size in the request content to obtain the data request identifier of this data request.
[0138] A data request is generated according to the request content determined above, and the data request is sent to the server, so that the server can return the corresponding data according to the data request. The client can obtain the corresponding data from the server by sending the data request.
[0139] In an exemplary embodiment of the present disclosure, for step S1430, a confirmation character tag array is generated based on the received request response data, including: determining an answer reply confirmation signaling according to the received request response data; determining a reception result of the data response packet, and updating the confirmation character tag array according to the reception result; generating a confirmation character signaling according to the answer reply confirmation signaling and the confirmation character tag array, the confirmation character signaling including one or more of a data request identifier, a data connection identifier, a request packet offset, a confirmation character tag array, and a reply packet timestamp; and sending the confirmation character signaling to the server.
[0140] After determining the request response data, the server can send the request response data to the client through the data response packet. The client determines the response reply confirmation signaling based on the received request response data. Each time the client receives DATA_RSP, it will determine whether the data response packet has been received and update the ACK flag array field in the ACK signaling. This field is in the format of a bitmap. If received, the position is set to 1, and if lost, it is set to 0. The client determines whether it needs to reply ACK based on the NeedACK field in the received data response packet. For example, when the client determines that the NeedACK field is true, it needs to send ACK signaling; when it determines that the NeedACK field is fasle, it does not need to send ACK signaling.
[0141] In addition, the confirmation character signaling sent by the client includes one or more of a data request identifier, a data connection identifier, a request packet offset, a confirmation character tag array, and a reply packet timestamp. The client sends the generated confirmation character signaling to the server so that the server can subsequently calculate the quality evaluation index of this data transmission based on the confirmation character signaling summary.
[0142] In addition, the UDP-based application layer transport protocol also has the QUIC protocol. The QUIC protocol has a complete set of protocol systems. From the perspective of the protocol stack, QUIC can be regarded as a collection of HTTP / 2, TLS and UDP. Compared with the TCP protocol, QUIC is simpler in design and has a faster transmission speed. At the same time, its security is not inferior to TCP. However, the QUIC protocol has the following defects: First, the essence of the QUIC protocol is reliable UDP, which means that the data packets in the protocol need to be submitted in sequence. If packet loss occurs, retransmission is required. This design will lead to slower transmission speeds in high packet loss scenarios. Secondly, the QUIC protocol needs to encrypt the entire data packet, which will bring a large overhead to the server's CPU. In many link transmission scenarios, the goal is to use a low-overhead UDP private protocol. Thirdly, in order to support the QUIC protocol, both the client and the server need to undergo major modifications, which will increase manpower and time costs. Therefore, in actual use, it can be decided whether to use the QUIC protocol to implement application layer transmission based on specific needs.
[0143] Furthermore, the present disclosure also provides a data transmission system, including: a client, used to send a connection establishment request to a server, and receive a connection establishment confirmation signaling returned by the server based on the connection establishment request; a server, used to send a connection establishment confirmation signaling to the client according to the connection establishment request to establish a two-way communication connection; the client is also used to send a data request to the server, receive request response data determined by the server based on the data request, and generate a confirmation character mark array according to the received request response data; the server is also used to determine the quality evaluation index of this data transmission according to the confirmation character mark array.
[0144] Since the data transmission protocol implementation disclosed in the present invention mainly includes three parts: connection establishment, data transmission, and quality evaluation, first, a two-handshake mechanism is designed for the connection establishment part. The client actively initiates the connection establishment. After receiving the connection establishment response packet from the server, it believes that it has the ability to transmit data and is ready to initiate a data request; then in the data transmission part, the client initiates data requests of different sizes after believing that the connection is successful. After receiving the data, the server reasonably slices and sends the data according to the requested data and range, and the client receives the data response packet within a certain period of time; the quality evaluation part mainly depends on the client's reply after receiving the data response packet, and determines whether to send an ACK response based on the flag bit in the data response packet from the server. After receiving the ACK response packet, the server can complete the establishment of a quality evaluation system such as packet loss rate and RTT.
[0145] Fig.15 is a block diagram of a data transmission device according to an exemplary embodiment, which is applied to a server. Fig.15 The data transmission device 1500 includes: a first connection establishing module 1510, a data sending module 1520, a confirmation array receiving module 1530 and a quality evaluation module 1540.
[0146] Specifically, the first connection establishment module 1510 is used to send a connection establishment confirmation signaling to the client based on the connection establishment request received from the client, and the connection establishment confirmation signaling is used to establish a two-way communication connection; the data sending module 1520 is used to determine the request response data based on the data request sent by the client, and send the request response data to the client; the confirmation array receiving module 1530 is used to receive the confirmation character mark array returned by the client, and the confirmation character mark array is generated based on the request response data received by the client; the quality evaluation module 1540 is used to determine the quality evaluation index of this data transmission according to the confirmation character mark array.
[0147] In an exemplary embodiment of the present disclosure, the first connection establishment module 1510 includes a first connection establishment unit, which is used to: receive a connection establishment request sent by a client, the connection establishment request includes a client device identifier of the client; based on the connection establishment request, determine the first network address and the first network port of the client, and save the client device identifier; send a connection establishment confirmation signaling to the client to establish a two-end communication connection, the connection establishment confirmation signaling includes a server device identifier and a client device identifier.
[0148] In an exemplary embodiment of the present disclosure, the data sending module 1520 includes a data determination unit, which is used to: determine request response data according to a data request, the request content of the data request includes one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; the data request identifier is obtained based on a hash calculation of a combined text of a server device identifier, a request file starting position, and a request file size of the server.
[0149] In an exemplary embodiment of the present disclosure, the data determination unit includes a data determination sub-unit, which is used to: determine a request file according to a data request; perform file splitting processing on the request file according to a maximum transmission unit to obtain segmented file data; and encapsulate multiple segmented file data into data response packets respectively to obtain request response data.
[0150] In an exemplary embodiment of the present disclosure, the data determination subunit is configured to perform: determining key fields of a data response packet, the key fields including one or more of a request packet offset, a data request identifier, a data connection identifier, and an answer reply confirmation signaling; generating a data response packet based on the key fields and the segmented file data.
[0151] In an exemplary embodiment of the present disclosure, the quality evaluation module 1540 includes a first quality evaluation unit, which is used to: in response to receiving the last confirmation signaling of the data request, traverse the confirmation character tag array, and summarize the quality evaluation related data of the data request; determine the quality evaluation index of this data transmission based on the quality evaluation related data.
[0152] In an exemplary embodiment of the present disclosure, the quality evaluation module 1540 also includes a second quality evaluation unit, which is used to: based on a pre-configured timing task, regularly execute connection and request check operations to obtain a request timeout result of a data request; when the request timeout result is greater than the pre-configured timeout period, summarize the quality evaluation related data of the data request according to the confirmation character mark array; and determine the quality evaluation index of this data transmission according to the quality evaluation related data.
[0153] In an exemplary embodiment of the present disclosure, the quality evaluation module 1540 also includes a quality evaluation subunit, which is used to: determine the number of packet losses and the total number of data packets based on quality evaluation related data; determine the data packet loss rate based on the number of packet losses and the total number of data packets; determine the number of confirmation packets and the number of confirmation reply packets received, and determine the data confirmation rate based on the number of confirmation packets and the number of confirmation reply packets; obtain the reply packet timestamp of the confirmation reply packet, and determine the data round-trip delay based on the current timestamp and the reply packet timestamp.
[0154] Fig.161 is a block diagram of a data transmission device according to an exemplary embodiment, which is applied to a client. Fig.16 The data transmission device 1600 includes: a second connection establishing module 1610, a data receiving module 1620 and a confirmation array generating module 1630.
[0155] Specifically, the second connection establishment module 1610 is used to send a connection establishment request to the server, and receive a connection establishment confirmation signaling returned by the server, where the connection establishment confirmation signaling is used to establish a two-way communication connection; the data receiving module 1620 is used to send a data request to the server, and receive request response data returned by the server based on the data request; the confirmation array generation module 1630 is used to generate a confirmation character mark array based on the received request response data, and send the confirmation character mark array to the server, where the confirmation character mark array is used to determine the quality evaluation index of this data transmission.
[0156] In an exemplary embodiment of the present disclosure, the second connection establishment module 1610 includes a second connection establishment unit, which is used to: obtain a server address of the server, the server address includes a second network address and a second network port; send a connection establishment request to the server based on the server address, the connection establishment request includes a client device identifier; receive a connection establishment confirmation signaling returned by the server, the connection establishment confirmation signaling includes a server device identifier and a client device identifier.
[0157] In an exemplary embodiment of the present disclosure, the data receiving module 1620 includes a data receiving unit, which is used to: determine the request content of the data request, the request content includes one or more of a data request identifier, a request file identifier, a request file starting position, a request file size, a task type, and a network type; generate a data request based on the request content, and send the data request to the server; the data request identifier is obtained by performing a hash calculation on the combined text of the server device identifier, the request file starting position, and the request file size.
[0158] In an exemplary embodiment of the present disclosure, the request response data includes a data response packet, and the confirmation array generation module 1630 includes a confirmation array generation unit, which is used to: determine the response reply confirmation signaling based on the received request response data; determine the reception result of the data response packet, and update the confirmation character mark array according to the reception result; generate a confirmation character signaling based on the response reply confirmation signaling and the confirmation character mark array, the confirmation character signaling including one or more of a data request identifier, a data connection identifier, a request packet offset, a confirmation character mark array, and a reply packet timestamp; and send the confirmation character signaling to the server.
[0159] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0160] Reference below Fig.17 1700 according to this embodiment of the present disclosure is described. Fig.17 The electronic device 1700 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0161] like Fig.17 As shown, the electronic device 1700 is in the form of a general computing device. The components of the electronic device 1700 may include, but are not limited to: the at least one processing unit 1710, the at least one storage unit 1720, a bus 1730 connecting different system components (including the storage unit 1720 and the processing unit 1710), and a display unit 1740.
[0162] The storage unit stores program codes, which can be executed by the processing unit 1710, so that the processing unit 1710 executes the steps according to various exemplary embodiments of the present disclosure described in the above “Exemplary Method” section of this specification.
[0163] The storage unit 1720 may include a readable medium in the form of a volatile storage unit, such as a random access storage unit (RAM) 1721 and / or a cache storage unit 1722 , and may further include a read-only storage unit (ROM) 1723 .
[0164] The storage unit 1720 may include a program / utility 1724 having a set (at least one) of program modules 1725, such program modules 1725 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include the implementation of a network environment.
[0165] Bus 1730 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0166] The electronic device 1700 may also communicate with one or more external devices 1770 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1700, and / or communicate with any device that enables the electronic device 1700 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 1750. Furthermore, the electronic device 1700 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 1760. As shown, the network adapter 1760 communicates with other modules of the electronic device 1700 via a bus 1730. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 1700, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0167] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory including instructions, and the above instructions can be executed by a processor of the device to complete the above data transmission method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0168] In an exemplary embodiment, a computer program product is also provided, including a computer program, and when the computer program is executed by a processor, any one of the above-mentioned data transmission methods is implemented.
[0169] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0170] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A data transmission method, characterized in that: Applied to the server, the method includes: Based on the received connection establishment request of the client, sending a connection establishment confirmation signaling to the client, wherein the connection establishment confirmation signaling is used to establish a two-end communication connection; Determine request response data based on the data request sent by the client, and send the request response data to the client; receiving a confirmation character tag array returned by the client, wherein the confirmation character tag array is generated based on the request response data received by the client; According to the confirmation character mark array, a quality evaluation index of this data transmission is determined.
2. The method according to claim 1, characterized in that The sending a connection establishment confirmation signaling to the client based on the received connection establishment request of the client includes: receiving a connection establishment request sent by the client, wherein the connection establishment request includes a client device identifier of the client; Based on the connection establishment request, determine a first network address and a first network port of the client, and save the client device identifier; The connection establishment confirmation signaling is sent to the client to establish a two-end communication connection, wherein the connection establishment confirmation signaling includes a server device identifier and a client device identifier.
3. The method according to claim 1, characterized in that The determining the request response data based on the data request sent by the client includes: Determining the request response data according to the data request, wherein the request content of the data request includes one or more of a data request identifier, a request file identifier, a request file start position, a request file size, a task type, and a network type; The data request identifier is obtained based on a hash calculation of a text combination of a server device identifier of the server, a starting position of the requested file, and a size of the requested file.
4. The method according to claim 3, characterized in that The determining the request response data according to the data request includes: determining a request file according to the data request; Performing file splitting processing on the requested file according to the maximum transmission unit to obtain segmented file data; The plurality of segmented file data are respectively encapsulated into data response packets to obtain the request response data.
5. The method according to claim 4, characterized in that The step of respectively encapsulating the plurality of segmented file data into data response packets to obtain the request response data comprises: Determine the key fields of the data response packet, where the key fields include one or more of a request packet offset, a data request identifier, a data connection identifier, and an answer reply confirmation signaling; The data response packet is generated based on the key field and the segmented file data.
6. The method according to claim 1, characterized in that Determining the quality evaluation index of the current data transmission according to the confirmation character mark array includes: In response to receiving the last confirmation signaling of the data request, traverse the confirmation character tag array and summarize the quality evaluation related data of the data request; A quality evaluation index for this data transmission is determined based on the quality evaluation related data.
7. The method according to claim 1, characterized in that The step of determining the quality evaluation index of the data transmission according to the confirmation character mark array further includes: Based on a pre-configured timed task, a connection and request check operation is periodically performed to obtain a request timeout result of the data request; When the request timeout result is greater than a pre-configured timeout period, summarizing the quality evaluation related data of the data request according to the confirmation character tag array; A quality evaluation index for this data transmission is determined based on the quality evaluation related data.
8. A data transmission method, characterized in that: Applied to a client, the method comprises: Sending a connection establishment request to the server, and receiving a connection establishment confirmation signaling returned by the server, wherein the connection establishment confirmation signaling is used to establish a two-way communication connection; Sending a data request to the server, and receiving request response data returned by the server based on the data request; A confirmation character mark array is generated based on the received request response data, and the confirmation character mark array is sent to the server. The confirmation character mark array is used to determine a quality evaluation index for this data transmission.
9. The method according to claim 8, characterized in that The sending of a connection establishment request to the server and receiving a connection establishment confirmation signaling returned by the server include: Obtaining a server address of the server, wherein the server address includes a second network address and a second network port; Sending the connection establishment request to the server based on the server address, wherein the connection establishment request includes a client device identifier; The connection establishment confirmation signaling returned by the server is received, wherein the connection establishment confirmation signaling includes the server device identifier and the client device identifier.
10. The method according to claim 8, characterized in that The request response data includes a data response packet, and the generating of a confirmation character tag array based on the received request response data includes: Determine the response reply confirmation signaling according to the received request response data; Determine the reception result of the data response packet, and update the confirmation character mark array according to the reception result; Generate a confirmation character signaling according to the response reply confirmation signaling and the confirmation character tag array, wherein the confirmation character signaling includes one or more of a data request identifier, a data connection identifier, a request packet offset, the confirmation character tag array, and a reply packet timestamp; The confirmation character signaling is sent to the service end.
11. A data transmission system, characterized in that: include: The client is used to send a connection establishment request to the server, and receive a connection establishment confirmation signaling returned by the server based on the connection establishment request; The server is used to send the connection establishment confirmation signaling to the client according to the connection establishment request to establish a two-end communication connection; The client is further configured to send a data request to the server, receive request response data determined by the server based on the data request, and generate a confirmation character tag array according to the received request response data; The server is further configured to determine a quality evaluation index for the current data transmission according to the confirmation character mark array.
12. A data transmission device, characterized in that: Applied to the server, the device comprises: A first connection establishment module, configured to send a connection establishment confirmation signaling to the client based on a connection establishment request received from the client, wherein the connection establishment confirmation signaling is used to establish a two-end communication connection; A data sending module, used to determine request response data based on the data request sent by the client, and send the request response data to the client; A confirmation array receiving module, used to receive a confirmation character tag array returned by the client, wherein the confirmation character tag array is generated based on the request response data received by the client; The quality evaluation module is used to determine the quality evaluation index of the data transmission according to the confirmation character mark array.
13. A data transmission device, characterized in that: Applied to a client, the device comprises: A second connection establishment module, used to send a connection establishment request to the server, and receive a connection establishment confirmation signaling returned by the server, wherein the connection establishment confirmation signaling is used to establish a two-end communication connection; A data receiving module, used to send a data request to the server, and receive request response data returned by the server based on the data request; The confirmation array generation module is used to generate a confirmation character mark array based on the received request response data, and send the confirmation character mark array to the service end. The confirmation character mark array is used to determine the quality evaluation index of this data transmission.
14. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the data transmission method as described in any one of claims 1 to 10.
15. A computer program product comprising a computer program, characterized in that When the computer program is executed by a processor, the data transmission method according to any one of claims 1 to 10 is implemented.
