WO2020134755A1 - 数据传输方法和装置 - Google Patents
数据传输方法和装置 Download PDFInfo
- Publication number
- WO2020134755A1 WO2020134755A1 PCT/CN2019/120037 CN2019120037W WO2020134755A1 WO 2020134755 A1 WO2020134755 A1 WO 2020134755A1 CN 2019120037 W CN2019120037 W CN 2019120037W WO 2020134755 A1 WO2020134755 A1 WO 2020134755A1
- Authority
- WO
- WIPO (PCT)
- Prior art keywords
- data
- data packet
- packet
- queue
- receiving end
- Prior art date
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L9/00—Cryptographic mechanisms or cryptographic arrangements for secret or secure communications; Network security protocols
- H04L9/40—Network security protocols
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/06—Notations for structuring of protocol data, e.g. abstract syntax notation one [ASN.1]
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L69/00—Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
- H04L69/22—Parsing or analysis of headers
Definitions
- the present application relates to the technical field of data transmission. Specifically, the present application relates to a data transmission method and device.
- the present application provides a data transmission method, including the following steps:
- the sending end extracts the stored data from the queue, assembles it into a data packet with an upper limit of data of a set length, sends it to the receiving end, and buffers the remaining data exceeding the set length in the buffer queue;
- the receiving end After receiving the data packet, the receiving end buffers the data packet until the received multiple data packets form a complete protocol packet, then the corresponding data packet is taken out and called back to the upper layer.
- the present application also provides a data transmission method, including the following steps:
- Extract the stored data from the queue assemble it into a data packet with an upper limit of data of a set length, send it to the receiving end, and cache the remaining data exceeding the set length in the cache queue;
- the data in the cache queue is added to the data packet and sent to the receiving end with the current transmission data; wherein, after receiving the data packet, the receiving end caches the data packet until When multiple received data packets form a complete protocol packet, the corresponding data packets are taken out and called back to the upper layer.
- a data transmission method includes the following steps:
- the data packet After receiving the data packet, the data packet is cached until the received multiple data packets form a complete protocol packet, and the corresponding data packet is taken out and called back to the upper layer.
- the present application also provides a data transmission system, which includes:
- the sending module is used for the sending end to extract the stored data from the queue, assemble it into a data packet with an upper limit of data of a set length, send it to the receiving end, and cache the remaining data exceeding the set length in the buffer queue ;
- the packet dividing module is used to add the data in the cache queue to the data packet when the data packet is assembled next time, and send the data sent to the receiving end with the current transmission data;
- the receiving module is used for receiving the data packet and buffering the data packet until the received multiple data packets form a complete protocol packet, then the corresponding data packet is taken out and called back to the upper layer.
- the present application also provides a data transmission device, including:
- the packet dividing module is used to extract the stored data from the queue, assemble it into a data packet with an upper limit of data of a set length, send it to the receiving end, and cache the remaining data exceeding the set length in the cache queue;
- An addition module is used to add the data in the cache queue to the data packet when the data packet is assembled next time, and send the data sent to the receiving end with the current transmission; wherein, after receiving the data packet, the receiving end The packet is cached until the received multiple data packets form a complete protocol packet, and the corresponding data packet is taken out and submitted to the upper layer.
- the present application also provides a data transmission device, including:
- the receiving module is used to receive the sender to extract the stored data from the queue; wherein, the data is assembled into a data packet with an upper limit of data of a set length, and the remaining data exceeding the set length is cached in the cache queue In the next time the data packet is assembled, the data in the cache queue is added to the data packet, and the data is sent with the current transmission;
- the callback module is used for buffering the data packet after receiving the data packet, until the received multiple data packets form a complete protocol packet, the corresponding data packet is taken out and called back to the upper layer.
- the present application also provides a computer device, which includes:
- One or more processors are One or more processors;
- One or more application programs wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs are configured to: execute The data transmission method described in any one of the above.
- the present application further provides a computer-readable storage medium that stores a computer program on the computer-readable storage medium, and when the computer program is executed by a processor, implements the data transmission method described in any one of the above.
- the present application can avoid the problem of unreasonable composition and distribution of data at the sending end and the receiving end of the traditional data transmission method, thereby affecting the data transmission.
- the process of data transmission by setting upper limit on data at the sending end, assembling and subpackaging, and buffering at the receiving end, and grouping according to the data packets from the same protocol package, so that the transmission data can be reasonably subcontracted and fast Ground packs improve the efficiency of data transmission.
- the data transmission method and device provided by the present application avoid the problem that the data composition and distribution at the sending end and the receiving end are unreasonable, which affects the data transmission.
- the process of data transmission by setting upper limit on data at the sending end, assembling and subpackaging, and buffering at the receiving end, and grouping according to the data packets from the same protocol package, so that the transmission data can be reasonably subcontracted and fast Ground packs improve the efficiency of data transmission.
- FIG. 1 is a flowchart of a data transmission method according to an embodiment of this application.
- FIG. 2 is an overall architecture diagram of data transmission in this application
- FIG. 3 is a flowchart of a data transmission method according to another embodiment of this application.
- FIG. 5 is a schematic diagram of a data transmission system according to an embodiment of this application.
- FIG. 6 is a schematic diagram of a data transmission device according to an embodiment of this application.
- FIG. 7 is a schematic diagram of a data transmission device according to an embodiment of this application.
- FIG. 8 is a schematic structural diagram of a computer device according to an embodiment of this application.
- FIG. 1 is a flowchart of a data transmission method according to an embodiment. The method includes the following steps:
- the sending end extracts the stored data from the queue, assembles it into a data packet with an upper limit of data of a set length, sends it to the receiving end, and caches the remaining data exceeding the set length in the buffer queue.
- each queue Before data is sent, it exists in the form of a queue, where each queue stores data from different protocols. Considering the efficiency of data transmission and transmission, before data transmission, the data is divided into several data packets assembled into an upper limit, which sets a length set for the data in the assembled data packet. If the length of the assembled queue is greater than the length set by the data packet, part of the data in the queue that exceeds the upper limit of the data packet is cached in the form of a buffer queue, and will not be the same as the data in the same queue that has been assembled in the data packet Send together, but wait for subsequent sending.
- the sending end After assembling the sub-packets, the sending end sends the data packets to the receiving end in sequence through the transport layer.
- step S110 When assembling the data packet for the next time, it is necessary to add the data of the cache queue that failed to be assembled into the data packet in step S110 as an object of assembly, assemble the data packet together with the data of the queue sent this time, and send it to the receiving end.
- the receiving end receives the data packet and caches the data packet until the received multiple data packets form a complete protocol packet, and then the corresponding data packet is taken out and called back to the upper layer.
- the data packet is first buffered.
- the buffered several data packets can form a complete protocol packet, it will be able to The data packets that make up the protocol package are extracted, and after the protocol package is formed, it is called back to the upper layer.
- FIG. 2 is an overall architecture diagram of data transmission in the method.
- the queues in step S110 include a first queue p0queue and a second queue p1queue, where the priority of the first queue p0queue is higher than the priority of the second queue p1queue, and the cache queues corresponding to each queue are the first The cache queue p0item and the second cache queue p1item.
- the priority of the first cache queue p0item is higher than the priority of the second cache queue p1item.
- the priority ranking of the above queue is that the buffer queue that was exceeded by the last assembled data packet B-Pack and cached is higher than the corresponding queue in the next data packet B-Pack transmission, that is, the second data packet Take the assembly of B-Pack as an example, the data priority of the queue assembled into a B-Pack is: p0item>p0queue>p0item>p1queue.
- the corresponding data packet B-Pack is assembled through the packet grouping layer SEG_FACTORY according to the above priority and sent to the receiving end.
- the window makeSeg() is called first.
- the sending window can be assembled into a data packet B-Pack with an upper limit of size according to the priority of the queue, that is, makeSeg(size).
- makeSeg(size) the priority of the queue
- the sending end discards the data, so as not to increase the burden on network resources.
- the sending end If the data sent by the sending end has been assembled into a data packet B-Pack and has not been sent out, if it is detected that the sending time of the data exceeds the timeout time of the data, the sending end will send the corresponding data packet B-Pack Discard. If there is no timeout, the sending end retransmits the data until the data packet B-Pack is sent within the timeout period.
- the receiving end When the data packet B-Pack is sent to the receiving end through the transport layer, and the receiving end receives the data packet, the data packet B-Pack is temporarily cached.
- the receiving end is provided with a temporary storage list B-Pack_map_list for caching.
- the receiving end receives the data packet B-Pack sent by the sending end through the onSeg interface, the data packet B-Pack is inserted into the storage list B-Pack_map_list for temporary storage.
- the receiving end extracts the related data packets B-Pack to form a complete protocol package.
- the protocol package is complete, immediately call onData() to the upper layer.
- the data packet B-Pack shares a protocol tag p_id, and the protocol tag p_id may be stored in a certain field of the data packet B-Pack.
- each protocol tag p_id is used as an index list, and each index key corresponds to a storage list list.
- the data packet B-Pack belonging to the same protocol package is stored in the same storage list with its index key until a complete protocol package is formed, and onData() is called back to the upper layer.
- a timeout detection is performed on the data packet B-Pack.
- the data packet B-Pack is discarded.
- the timeout detection may also be periodic detection Whether the duration of the buffered data packet exceeds the timeout duration. If it is detected that the duration of receiving the data packet B-Pack is overtime, and a complete protocol package has not yet been formed, extract other data packets B-Pack belonging to the same protocol according to the protocol tag p_id of the data packet B-Pack, and Discard all B-Packs belonging to the same protocol.
- Each said data packet B-Pack may include its generation time.
- the latest generation time in the data packet received by the receiving end is set as the maximum time stamp. If the time-out duration of the data packet B-Pack is less than the maximum time stamp, the corresponding data packet times out.
- the sender sends the first data packet B-Pack, the second data packet B-Pack, and the third data packet B-Pack at the 0th, 10th, and 15th seconds, respectively, and all set timeout periods. Both are 10 seconds.
- the receiving end first receives the second data packet B-Pack, then the receiving end considers 10 seconds as the maximum time stamp; if the receiving end receives the third data packet B-Pack, then the receiving end re-identifies 15 seconds as the maximum time stamp. And the first data packet B-Pack was received last, then the receiving end needs to check whether the first data packet B-Pack has timed out: the maximum time stamp is 15 seconds minus the time-out time of the first data packet B-Pack is 10 In seconds, a value greater than 0 is obtained, that is, the transmission of the first data packet B-Pack times out.
- the data transmission method provided by the present application solves the problem that the data composition and distribution at the sending end and the receiving end are unreasonable, which affects the data transmission.
- the process of data transmission by setting upper limit on data at the sending end, assembling and subpackaging, and buffering at the receiving end, and grouping according to the data packets from the same protocol package, so that the transmission data can be reasonably subcontracted and fast Ground packs improve the efficiency of data transmission.
- the sending end and the receiving end respectively perform timeout judgment on the data being processed by each of them, and if timeout, discard the corresponding data or data packet B-Pack, thereby solving the traditional fully reliable transmission technology after timeout
- the problem of easily increasing the burden on the network continues to be transmitted.
- the receiving end also sets the latest generation time of the data packets received by it as the maximum time stamp, and the maximum time stamp is used to Corresponding to the timeout duration, the corresponding data packet is judged to be timeout. Further, in order to effectively transmit important data in limited network resources, the sending end prioritizes the data, queues the data to prioritize, and assembles and subcontracts according to the priority, and then For transmission.
- the data packet B-Pack is grouped and uploaded or discarded, so that the data packet can quickly form a complete protocol package and upload to complete the data transmission.
- FIG. 3 is a flowchart of a data transmission method according to an embodiment. The method includes the following steps:
- each queue Before data is sent, it exists in the form of a queue, where each queue stores data from different protocols. Considering the efficiency of data transmission and transmission, before data transmission, the data is divided into several data packets assembled into an upper limit, which sets a length set for the data in the assembled data packet. If the length of the assembled queue is greater than the length set by the data packet, part of the data in the queue that exceeds the upper limit of the data packet is cached in the form of a buffer queue, and will not be the same as the data in the same queue that has been assembled in the data packet Send together, but wait for subsequent sending.
- the sending end After assembling the sub-packets, the sending end sends the data packets through the transport layer in sequence.
- the receiving end receives the data packet sent by the sending end through the transport layer
- the data packet is first buffered.
- the cached several data packets can form a complete protocol packet, it will be able to form a protocol packet
- the data packet is extracted and composed into a protocol packet, it is called back to the upper layer.
- FIG. 2 is an overall architecture diagram of data transmission in the method.
- the queues in step S110 include a first queue p0queue and a second queue p1queue, where the priority of the first queue p0queue is higher than the priority of the second queue p1queue, and the cache queues corresponding to each queue are the first The cache queue p0item and the second cache queue p1item.
- the priority of the first cache queue p0item is higher than the priority of the second cache queue p1item.
- the priority ranking of the above queue is that the buffer queue that was exceeded by the last assembled data packet B-Pack and cached is higher than the corresponding queue in the next data packet B-Pack transmission, that is, the second data packet Take the assembly of B-Pack as an example, the data priority of the queue assembled into a B-Pack is: p0item>p0queue>p0item>p1queue.
- the corresponding data packet B-Pack is assembled through the packet grouping layer SEG_FACTORY according to the above priority and sent to the receiving end.
- the window makeSeg() is called first.
- the sending window can be assembled into a data packet B-Pack with an upper limit of size according to the priority of the queue, that is, makeSeg(size).
- makeSeg(size) the priority of the queue
- the sending end discards the data, so as not to increase the burden on network resources.
- the sending end If the data sent by the sending end has been assembled into a data packet B-Pack and has not been sent out, if it is detected that the sending time of the data exceeds the timeout time of the data, the sending end will send the corresponding data packet B-Pack Discard. If there is no timeout, the sending end retransmits the data until the data packet B-Pack is sent within the timeout period.
- the data transmission method provided by the present application solves the problem that the data composition and distribution at the sending end and the receiving end are unreasonable, which affects the data transmission.
- the upper end of the data is set at the sending end to assemble the sub-packet, so that the transmitted data can be reasonably sub-packed and the efficiency of data transmission is improved.
- the sending end makes a timeout judgment on the data being processed. If it times out, the corresponding data or data packet B-Pack is discarded, thereby solving the problem that the traditional fully reliable transmission technology continues to send after the timeout.
- the problem of increasing network burden Further, the queues composed of data are prioritized, and assembled and subcontracted according to the priorities, and then sent, and the effective use of limited network resources to effectively transmit important data.
- FIG. 4 is a flowchart of a data transmission method according to an embodiment. The method includes the following steps:
- the receiving and sending end extracts the stored data from the queue; wherein, the data is assembled into a data packet with an upper limit of data of a set length, and the remaining data exceeding the set length is cached in the cache queue.
- the data in the cache queue is added to the data packet and sent with the current data transmission.
- the receiving end summarizes and extracts the stored data from the queue.
- the data exists in the form of queues before being sent, in which each queue stores data from different protocols.
- the data is divided into several data packets assembled into an upper limit, which sets a length set for the data in the assembled data packet. If the length of the assembled queue is greater than the length set by the data packet, part of the data in the queue that exceeds the upper limit of the data packet is cached in the form of a buffer queue, and will not be the same as the data in the same queue that has been assembled in the data packet Send together, but wait for subsequent sending.
- the sending end After assembling the sub-packets, the sending end sends the data packets to the receiving end in sequence through the transport layer.
- the data packet is first buffered.
- the buffered several data packets can form a complete protocol packet, it will be able to The data packets that make up the protocol package are extracted, and after the protocol package is formed, it is called back to the upper layer.
- FIG. 2 is an overall architecture diagram of data transmission in the method.
- the receiving end When the data packet B-Pack is sent from the sending end to the receiving end through the transmission layer, and the receiving end receives the data packet, the data packet B-Pack is temporarily cached.
- the receiving end is provided with a temporary storage list B-Pack_map_list for caching.
- the receiving end receives the data packet B-Pack sent by the sending end through the onSeg interface, the data packet B-Pack is inserted into the storage list B-Pack_map_list for temporary storage.
- the receiving end extracts related data packets B-Pack to form a complete protocol package.
- the protocol package is complete, immediately call onData() to the upper layer.
- the data packet B-Pack shares a protocol tag p_id, and the protocol tag p_id may be stored in a certain field of the data packet B-Pack.
- each protocol tag p_id is used as an index list, and each index key corresponds to a storage list list.
- the data packet B-Pack belonging to the same protocol package is stored in the same storage list with its index key until a complete protocol package is formed, and onData() is called back to the upper layer.
- a timeout detection is performed on the data packet B-Pack.
- the data packet B-Pack is discarded.
- the timeout detection may also be periodic detection Whether the duration of the buffered data packet exceeds the timeout duration. If it is detected that the duration of receiving the data packet B-Pack is overtime, and a complete protocol package has not yet been formed, extract other data packets B-Pack belonging to the same protocol according to the protocol tag p_id of the data packet B-Pack, and Discard all B-Packs belonging to the same protocol.
- Each said data packet B-Pack may include its generation time.
- the latest generation time in the data packet received by the receiving end is set as the maximum time stamp. If the time-out duration of the data packet B-Pack is less than the maximum time stamp, the corresponding data packet times out.
- the sender sends the first data packet B-Pack, the second data packet B-Pack, and the third data packet B-Pack at the 0th, 10th, and 15th seconds, respectively, and all set timeout periods. Both are 10 seconds.
- the receiving end first receives the second data packet B-Pack, then the receiving end considers 10 seconds as the maximum time stamp; if the receiving end receives the third data packet B-Pack, then the receiving end re-identifies 15 seconds as the maximum time stamp. And the first data packet B-Pack was received last, then the receiving end needs to check whether the first data packet B-Pack has timed out: the maximum time stamp is 15 seconds minus the time-out time of the first data packet B-Pack is 10 In seconds, a value greater than 0 is obtained, that is, the transmission of the first data packet B-Pack times out.
- a data transmission method provided by the present application solves the problem that the data composition and distribution at the receiving end of the data are unreasonable, thereby affecting data reception.
- the received data can be quickly grouped, which improves the efficiency of data reception.
- the receiving end performs timeout judgment on the respective data being processed respectively, and if it times out, discards the corresponding data or data packet B-Pack, thereby solving the problem that the traditional fully reliable transmission technology continues to transmit after timeout It is easy to increase the burden of the network.
- the receiving end also sets the latest generation time of the data packets received by it as the maximum time stamp, and the maximum time stamp is used to Corresponding to the timeout duration, the corresponding data packet is judged to be timeout.
- the data packet B-Pack is grouped and uploaded or discarded, so that the data packet can be quickly composed into a complete protocol package and uploaded, complete data transmission.
- an embodiment of the present application also provides a data transmission system, as shown in FIG. 5, including:
- the sending module 510 is used for the sending end to extract the stored data from the queue, assemble it into a data packet with an upper limit of data of a set length, send it to the receiving end, and cache the remaining data exceeding the set length in the buffer queue in;
- the packet dividing module 520 is used to add the data in the cache queue to the data packet when the data packet is assembled next time, and send the data sent to the receiving end with the current sending data;
- the receiving module 530 is configured to, after receiving the data packet, buffer the data packet until the received multiple data packets form a complete protocol packet, take out the corresponding data packet and call back to the upper layer.
- an embodiment of the present application further provides a data transmission device, as shown in FIG. 6, including:
- the packet dividing module 610 is used to extract the stored data from the queue, assemble it into a data packet with an upper limit of data of a set length, send it to the receiving end, and cache the remaining data exceeding the set length in the cache queue ;
- the adding module 620 is used to add the data in the cache queue to the data packet when the data packet is assembled next time, and send the data to the receiving end with the current sending data; wherein, after receiving the data packet, the receiving end The data packets are cached until the received multiple data packets form a complete protocol packet, and the corresponding data packets are taken out and submitted to the upper layer.
- an embodiment of the present application further provides a data transmission device, as shown in FIG. 7, including:
- the receiving module 710 is used to receive the sender to extract the stored data from the queue; wherein, the data is assembled into a data packet with an upper limit of data of a set length, and the remaining data exceeding the set length is cached in the cache In the queue, when the data packet is assembled next time, the data in the cache queue is added to the data packet, and the data is sent with the current transmission;
- the callback module 720 is configured to cache the data packet after receiving the data packet until the received multiple data packets form a complete protocol packet, and then take out the corresponding data packet and call back to the upper layer.
- FIG. 8 is a schematic diagram of an internal structure of a computer device in an embodiment.
- the computer device includes a processor 810, a storage medium 820, a memory 830, and a network interface 840 connected through a system bus.
- the storage medium 820 of the computer device stores an operating system, a database, and computer-readable instructions.
- the database may store control information sequences.
- the processor 810 may implement a In the data transmission method, the processor 810 can implement the functions of the sending module 510, the separate module 520, and the receiving module 530 in the data transmission system in the embodiment shown in FIG.
- the processor 810 of the computer device is used to provide calculation and control capabilities and support the operation of the entire computer device.
- the memory 830 of the computer device may store computer readable instructions. When the computer readable instructions are executed by the processor 1, the processor 810 may execute a data transmission method.
- the network interface 840 of the computer device is used to connect and communicate with the terminal.
- the present application further proposes a storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the following steps: send The terminal extracts the stored data from the queue, assembles it into a data packet with an upper limit of data of a set length, sends it to the receiving end, and caches the remaining data exceeding the set length in the cache queue; the next time the data packet is assembled At the time, add the data in the cache queue to the data packet, and send the data to the receiving end with the current transmission data; after receiving the data packet, the receiving end caches the data packet until multiple received data packets When a complete protocol packet is formed, the corresponding data packet is taken out and called back to the upper layer.
- the data transmission method provided by the present application solves the problem that the data composition and distribution at the sending end and the receiving end are unreasonable, which affects the data transmission.
- the process of data transmission by setting upper limit on data at the sending end, assembling and subpackaging, and buffering at the receiving end, and grouping according to the data packets from the same protocol package, so that the transmission data can be reasonably subcontracted and fast Ground packs improve the efficiency of data transmission.
- the sending end and the receiving end respectively perform timeout judgment on the data being processed by each of them, and if timeout, discard the corresponding data or data packet B-Pack, thereby solving the traditional fully reliable transmission technology after timeout
- the receiving end also sets the latest generation time of the data packets received by it as the maximum time stamp, and the maximum time stamp is used to Corresponding to the timeout duration, the corresponding data packet is judged to be timeout.
- the sending end prioritizes the data, queues the data to prioritize, and assembles and subcontracts according to the priority, and then For transmission.
- the receiving end according to the protocol tag p_id of the data packet B-Pack, the data packet B-Pack is grouped and uploaded or discarded, so that the data packet can quickly form a complete protocol package and upload to complete the data transmission.
- the computer program may be stored in a computer-readable storage medium. When executed, it may include the processes of the foregoing method embodiments.
- the foregoing storage medium may be a storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM), etc.
Landscapes
- Engineering & Computer Science (AREA)
- Computer Security & Cryptography (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
- Communication Control (AREA)
Abstract
本申请涉及数据传输技术领域,本申请提供一种数据传输方法和装置,所述方法包括发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。本申请能达到提高数据传输的效率。
Description
本申请涉及数据传输技术领域,具体而言,本申请涉及一种数据传输方法和装置。
在互联网的数据传输中,尤其是信令传输往往会因为传输链路、传输段设备或者是所发送数据量等原因,影响数据的传输。在传统的信令传输技术通常使用完全可靠的传输方式,由于在发送端和接收端的数据组成和分配不合理,影响数据的传输。
发明内容
本申请的目的旨在至少能解决上述的技术缺陷之一,特别是现有技术中数据组成和分配不合理的问题,特提出以下技术方案:
第一方面,本申请提供一种数据传输方法,包括以下步骤:
发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;
在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;
接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
第二方面,本申请还提供一种数据传输方法,包括以下步骤:
从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;
在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;其中,接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
第三方面,一种数据传输方法,包括以下步骤:
接收发送端从队列中提取存储的数据;其中,所述数据组装成上限为设定长度的数据的数据包,并将超出所述设定长度部分的剩余数据缓存在缓存队列中,在下一次组装数据包时,将所述缓存队列中的数据添加至数据包中,并与当次发送数据发送;
接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
第四方面,本申请还提供一种数据传输***,其包括:
发送模块,用于发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;
分包模块,用于在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;
接收模块,用于接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
第五方面,本申请还提供一种数据传输装置,其包括:
分包模块,用于从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;
添加模块,用于在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;其中,接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出提交给上层。
第六方面,本申请还提供一种数据传输装置,其包括:
接收模块,用于接收发送端从队列中提取存储的数据;其中,所述数据组装成上限为设定长度的数据的数据包,并将超出所述设定长度部分的剩余数据缓存在缓存队列中,在下一次组装数据包时,将所述缓存队列中的数据添加至数据包中,并与当次发送数据发送;
回调模块,用于接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
第七方面,本申请还提供一种计算机设备,其包括:
一个或多个处理器;
存储器;
一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于:执行上述任一项所述的数据传输方法。
第八方面,本申请还提供一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现上述任一项所述的数据传输方法。本申请可避免传统的数据传输方法中,在数据在发送端和接收端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在发送端设置上限组装分包,以及在接收端进行缓存,并根据来自同一协议包的数据包进行组包,使得传输数据可以得到合理的分包和快速地组包,提高了数据传输的效率。
本申请提供的一种数据传输方法和装置,避免了在数据在发送端和接收端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在发送端设置上限组装分包,以及在接收端进行缓存,并根据来自同一协议包的数据包进行组包,使得传输数据可以得到合理的分包和快速地组包,提高了数据传输的效率。
本申请附加的方面和优点将在下面的描述中部分给出,这些将从下面的描述中变得明显,或通过本申请的实践了解到。
本申请上述的和/或附加的方面和优点从下面结合附图对实施例的描述中将变得明显和容易理解,其中:
图1为本申请中的一个实施例的数据传输方法的流程图;
图2为本申请中数据传输的整体的架构图;
图3为本申请中的另一个实施例的数据传输方法的流程图;
图4为本申请中的又一个实施例的数据传输方法的流程图;
图5为本申请中的一个实施例的数据传输***的示意图;
图6为本申请中的一个实施例的数据传输装置的示意图;
图7为本申请中的一个实施例的数据传输装置的示意图;
图8为本申请中的一个实施例的计算机设备的结构示意图。
为了解决传统的数据传输技术中数据组成和分配不合理影响数据传输的问题。本申请提供了一种数据传输方法,该方法是在发送端和接收端之间的数据交互中完成的,可参考图1所示,图1是一个实施例的数据传输方法的流程图,该方法包括以下步骤:
S110、发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中。
数据待发送前,以队列的方式存在,其中每个队列中存储来自不同协议的数据。考虑到数据发送和传输的效率,在数据发送前,将数据分成若干组装成具有上限的数据包,所述上限对组装数据包中的数据所设定的长度。若所述组装的队列长度大于所述数据包设定的长度,将队列超出所述数据包上限的部分数据以缓存队列的形式缓存下来,不会与已组装于数据包中原来同队列的数据一同发送,而是等待后续发送。
当组装分包后,发送端通过传输层将数据包依次向接收端发送。
S120、在下一次发送数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端。
在下一次组装数据包时,需要将在步骤S110中未能组装成数据包的缓存队列的数据添加成为组装的对象,与当次发送的队列的数据一同组装 成数据包,向接收端发送。
S130、接收端接收数据包,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
在此步骤中,接收端接收由发送端通过传输层所发送数据包后,将该数据包先进行缓存,当检测到所缓存的若干个数据包中能组成一个完整的协议包时,将能够组成协议包的数据包提取出来,并组成协议包后并向上层回调。
为了避免在数据在发送端和接收端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在发送端设置上限组装分包,以及在接收端进行缓存,并根据来自同一协议包的数据包进行组包,使得传输数据可以得到合理的分包和快速地组包,提高了数据传输的效率。
在后续对本申请的进一步描述中,可参考图2所示,图2为本方法中数据传输的整体的架构图。
根据图2所示,步骤S110中的队列包括第一队列p0queue和第二队列p1queue,其中第一队列p0queue的优先级高于第二队列p1queue的优先级,各队列对应的缓存队列分别为第一缓存队列p0item和第二缓存队列p1item。对应地,第一缓存队列p0item的优先级高于第二缓存队列p1item的优先级。
具体到上述队列的优先级排序为由上一次组装数据包B-Pack超出并进行缓存的缓存队列的优先级高于下一次数据包B-Pack传输中相应的队列,即以第二次数据包B-Pack的组装为例,组装成一个数据包B-Pack的队列的数据优先级先后顺序为:p0item>p0queue>p0item>p1queue。
发送端进行传输的过程中,根据上述的优先级通过分包组包层SEG_FACTORY组装相应的数据包B-Pack,并向接收端发送。
在组装成上限为设定长度的数据的数据包的步骤之前,先调用窗口makeSeg()。所述发送窗口能够根据队列的优先级,组装成上限为size的一个数据包B-Pack,即makeSeg(size)。但如果调用所述发送窗口的时长超过所发送数据的超时时长时,发送端对该数据进行丢弃,以免对网络资源增加负担。
若所发送端发送的数据已组装成数据包B-Pack,且并未发送出去时,如果检测到该数据的发送时长超过该数据的超时时长,所述发送端将对应的数据包B-Pack进行丢弃。如果未超时,发送端对所述数据实施重传,直到将该数据包B-Pack在超时时长之内发送完毕。
当数据包B-Pack通过传输层发送至所述接收端,且接收端对所述数据包进行接收后,将所述数据包B-Pack进行临时缓存。在本实施例中,接收端设有进行缓存的临时存储列表B-Pack_map_list。当接收端通过onSeg接口接收到由发送端发送过来的数据包B-Pack时,将所述数据包B-Pack***至存储列表B-Pack_map_list进行临时存储。当检测到所述临 时存储列表B-Pack_map_list中的若干数据包B-Pack能够组成一个完整的协议包时,接收端将相关的数据包B-Pack提取出来,组成一个完整的协议包。当所述协议包组成完整后,立即向上层进行回调onData()。
在本实施例中,所述数据包B-Pack共有一个协议标记p_id,该协议标记p_id可存储于所述数据包B-Pack的某个字段中。在接收端组成协议包的过程中,每个协议标记p_id作为索引list,每个索引key对应一个存储列表list。属于同一协议包的数据包B-Pack以其索引key存储至同一个存储列表list中,直到组成一个完整的协议包,并上向上层进行回调onData()。
在接收端处,在数据包向上层进行回调之前,对数据包B-Pack进行超时检测。
若检测到其接收到的数据包B-Pack的时长超过其对应的超时时长,就将该数据包B-Pack进行丢弃。
考虑到数据或数据包B-Pack可能在发送端被丢弃、重传失败或者是在传输的过程中丢失等不能到达并被接收端接收的情况,所述超时检测也可以是定期检测接收到进行缓存的数据包的时长是否超过所述超时时长。如果检测到接收到所述数据包B-Pack的时长超时时长,仍未组成完整的协议包时,根据数据包B-Pack的协议标记p_id,提取属于相同协议的其他数据包B-Pack,并对该属于相同协议的所有数据包B-Pack进行丢弃。
为了避免发送端和接收端因位于不同设备,而时钟难以保持完全一致影响对时的问题。每个所述数据包B-Pack可包括其生成时间。将所述接收端所接收的数据包中最晚生成时间设定为最大时间戳。如果数据包B-Pack的超时时长小于所述最大时间戳,则对应的数据包超时。例如,发送端分别在第0秒、第10秒和第15秒发送了第一数据包B-Pack、第二数据包B-Pack和第三数据包B-Pack,且均设定的超时时长均为10秒。接收端先接收到第二数据包B-Pack,那么接收端认定10秒为最大时间戳;若接收端再接收到第三数据包B-Pack,那么接收端重新认定15秒为最大时间戳。而第一数据包B-Pack是最后接收到的,那么接收端需对第一数据包B-Pack检查其是否超时:将最大时间戳15秒减去第一数据包B-Pack的超时时长10秒,得到大于0的数值,即第一数据包B-Pack的传输超时。
本申请提供的一种数据传输方法,解决了在数据在发送端和接收端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在发送端设置上限组装分包,以及在接收端进行缓存,并根据来自同一协议包的数据包进行组包,使得传输数据可以得到合理的分包和快速地组包,提高了数据传输的效率。进一步地,所述发送端和接收端分别对各自正在处理的数据进行超时判断,若超时,对相应的数据或数据包B-Pack进行丢弃,从而解决了传统的全可靠的传输技术在超时后还继续传输所容易增加网络负担的问题。进一步地,为了解决发送端和接收端位于不同设备对时难的问题,接收端还将其所接收的数据包中产生最晚 生成时间设定为最大时间戳,以该最大时间戳与数据包对应的超时时长进行对比,判对应的数据包是否超时。进一步地,为了在有限的网络资源中对重要的数据进行有效传输,发送端对数据的发送之前,对数据组成的队列进行优先级的排序,并根据所述优先级进行组装分包,然后再进行传输。同时,在接收端处,根据数据包B-Pack的协议标记p_id,对所述数据包B-Pack进行组包并上传或者丢弃,使数据包能够快速组成一个完整的协议包并上传,完成数据传输。
为了解决传统的数据传输技术中数据组成和分配不合理影响数据传输的问题。本申请在另一个实施例中提供了一种数据传输方法,该方法是在发送端发送数据的过程中,可参考图3所示,图3是一个实施例的数据传输方法的流程图,该方法包括以下步骤:
S310、从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中。
数据待发送前,以队列的方式存在,其中每个队列中存储来自不同协议的数据。考虑到数据发送和传输的效率,在数据发送前,将数据分成若干组装成具有上限的数据包,所述上限对组装数据包中的数据所设定的长度。若所述组装的队列长度大于所述数据包设定的长度,将队列超出所述数据包上限的部分数据以缓存队列的形式缓存下来,不会与已组装于数据包中原来同队列的数据一同发送,而是等待后续发送。
当组装分包后,发送端通过传输层将数据包依次发送。
S320、在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;其中,接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
在下一次组装数据包时,需要将未能组装成数据包的缓存队列的数据添加成为组装的对象,与当次发送的队列的数据一同组装成数据包并发送。
其中,接收端接收由发送端通过传输层所发送数据包后,将该数据包先进行缓存,当检测到所缓存的若干个数据包中能组成一个完整的协议包时,将能够组成协议包的数据包提取出来,并组成协议包后并向上层回调。
为了避免在数据在发送端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在发送端设置上限组装分包,使得传输发送可以得到合理的分包,提高了数据发送的效率。
在后续对本申请的进一步描述中,可参考图2所示,图2为本方法中数据传输的整体的架构图。
根据图2所示,步骤S110中的队列包括第一队列p0queue和第二队列p1queue,其中第一队列p0queue的优先级高于第二队列p1queue的优先级,各队列对应的缓存队列分别为第一缓存队列p0item和第二缓存队 列p1item。对应地,第一缓存队列p0item的优先级高于第二缓存队列p1item的优先级。
具体到上述队列的优先级排序为由上一次组装数据包B-Pack超出并进行缓存的缓存队列的优先级高于下一次数据包B-Pack传输中相应的队列,即以第二次数据包B-Pack的组装为例,组装成一个数据包B-Pack的队列的数据优先级先后顺序为:p0item>p0queue>p0item>p1queue。
发送端进行传输的过程中,根据上述的优先级通过分包组包层SEG_FACTORY组装相应的数据包B-Pack,并向接收端发送。
在组装成上限为设定长度的数据的数据包的步骤之前,先调用窗口makeSeg()。所述发送窗口能够根据队列的优先级,组装成上限为size的一个数据包B-Pack,即makeSeg(size)。但如果调用所述发送窗口的时长超过所发送数据的超时时长时,发送端对该数据进行丢弃,以免对网络资源增加负担。
若所发送端发送的数据已组装成数据包B-Pack,且并未发送出去时,如果检测到该数据的发送时长超过该数据的超时时长,所述发送端将对应的数据包B-Pack进行丢弃。如果未超时,发送端对所述数据实施重传,直到将该数据包B-Pack在超时时长之内发送完毕。
本申请提供的一种数据传输方法,解决了在数据在发送端和接收端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在发送端设置上限组装分包,使得发送数据可以得到合理的分包提高了数据发送的效率。进一步地,所述发送端对正在处理的数据进行超时判断,若超时,对相应的数据或数据包B-Pack进行丢弃,从而解决了传统的全可靠的传输技术在超时后还继续发送所容易增加网络负担的问题。进一步地,对数据组成的队列进行优先级的排序,并根据所述优先级进行组装分包,然后再进行发送,有效利用有限的网络资源对重要的数据进行有效传输。
为了解决传统的数据传输技术中数据组成和分配不合理影响数据传输的问题。本申请在又一个实施例中提供了一种数据传输方法,该方法是在接收端接收数据的过程中,可参考图4所示,图4是一个实施例的数据传输方法的流程图,该方法包括以下步骤:
S410、接收发送端从队列中提取存储的数据;其中,所述数据组装成上限为设定长度的数据的数据包,并将超出所述设定长度部分的剩余数据缓存在缓存队列中,在下一次组装数据包时,将所述缓存队列中的数据添加至数据包中,并与当次发送数据发送。
接收端对队列汇总提取存储的数据。其中,数据待发送前,以队列的方式存在,其中每个队列中存储来自不同协议的数据。考虑到数据发送和传输的效率,在数据发送前,将数据分成若干组装成具有上限的数据包,所述上限对组装数据包中的数据所设定的长度。若所述组装的队列长度大于所述数据包设定的长度,将队列超出所述数据包上限的部分数据以缓存 队列的形式缓存下来,不会与已组装于数据包中原来同队列的数据一同发送,而是等待后续发送。
当组装分包后,发送端通过传输层将数据包依次向接收端发送。
在下一次组装数据包时,需要将未能组装成数据包的缓存队列的数据添加成为组装的对象,与当次发送的队列的数据一同组装成数据包,向接收端发送。
S420、接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
在此步骤中,接收端接收由发送端通过传输层所发送数据包后,将该数据包先进行缓存,当检测到所缓存的若干个数据包中能组成一个完整的协议包时,将能够组成协议包的数据包提取出来,并组成协议包后并向上层回调。
为了避免在数据在接收端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在在接收端进行缓存,并根据来自同一协议包的数据包进行组包,使得接收数据可以快速地组包,提高了数据接收的效率。
在后续对本申请的进一步描述中,可参考图2所示,图2为本方法中数据传输的整体的架构图。
当数据包B-Pack通过传输层从发送端发送至所述接收端,且接收端对所述数据包进行接收后,将所述数据包B-Pack进行临时缓存。在本实施例中,接收端设有进行缓存的临时存储列表B-Pack_map_list。当接收端通过onSeg接口接收到由发送端发送过来的数据包B-Pack时,将所述数据包B-Pack***至存储列表B-Pack_map_list进行临时存储。当检测到所述临时存储列表B-Pack_map_list中的若干数据包B-Pack能够组成一个完整的协议包时,接收端将相关的数据包B-Pack提取出来,组成一个完整的协议包。当所述协议包组成完整后,立即向上层进行回调onData()。
在本实施例中,所述数据包B-Pack共有一个协议标记p_id,该协议标记p_id可存储于所述数据包B-Pack的某个字段中。在接收端组成协议包的过程中,每个协议标记p_id作为索引list,每个索引key对应一个存储列表list。属于同一协议包的数据包B-Pack以其索引key存储至同一个存储列表list中,直到组成一个完整的协议包,并上向上层进行回调onData()。
在接收端处,在数据包向上层进行回调之前,对数据包B-Pack进行超时检测。
若检测到其接收到的数据包B-Pack的时长超过其对应的超时时长,就将该数据包B-Pack进行丢弃。
考虑到数据或数据包B-Pack可能在发送端被丢弃、重传失败或者是在传输的过程中丢失等不能到达并被接收端接收的情况,所述超时检测也可以是定期检测接收到进行缓存的数据包的时长是否超过所述超时时长。 如果检测到接收到所述数据包B-Pack的时长超时时长,仍未组成完整的协议包时,根据数据包B-Pack的协议标记p_id,提取属于相同协议的其他数据包B-Pack,并对该属于相同协议的所有数据包B-Pack进行丢弃。
为了避免发送端和接收端因位于不同设备,而时钟难以保持完全一致影响对时的问题。每个所述数据包B-Pack可包括其生成时间。将所述接收端所接收的数据包中最晚生成时间设定为最大时间戳。如果数据包B-Pack的超时时长小于所述最大时间戳,则对应的数据包超时。例如,发送端分别在第0秒、第10秒和第15秒发送了第一数据包B-Pack、第二数据包B-Pack和第三数据包B-Pack,且均设定的超时时长均为10秒。接收端先接收到第二数据包B-Pack,那么接收端认定10秒为最大时间戳;若接收端再接收到第三数据包B-Pack,那么接收端重新认定15秒为最大时间戳。而第一数据包B-Pack是最后接收到的,那么接收端需对第一数据包B-Pack检查其是否超时:将最大时间戳15秒减去第一数据包B-Pack的超时时长10秒,得到大于0的数值,即第一数据包B-Pack的传输超时。
本申请提供的一种数据传输方法,解决了在数据在接收端的数据组成和分配不合理从而影响数据的接收的问题。在数据传输的过程中,通过在接收端进行缓存,并根据来自同一协议包的数据包进行组包,使得接收数据可以快速地组包,提高了数据接收的效率。进一步地,所述接收端分别对各自正在处理的数据进行超时判断,若超时,对相应的数据或数据包B-Pack进行丢弃,从而解决了传统的全可靠的传输技术在超时后还继续传输所容易增加网络负担的问题。进一步地,为了解决发送端和接收端位于不同设备对时难的问题,接收端还将其所接收的数据包中产生最晚生成时间设定为最大时间戳,以该最大时间戳与数据包对应的超时时长进行对比,判对应的数据包是否超时。同时,在接收端处,根据数据包B-Pack的协议标记p_id,对所述数据包B-Pack进行组包并上传或者丢弃,使数据包能够更加快速组成一个完整的协议包并上传,完成数据传输。
基于与发送端和接收端交互的数据传输方法相同的发明构思,本申请实施例还提供了一种数据传输***,如图5所示,包括:
发送模块510,用于发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;
分包模块520,用于在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;
接收模块530,用于接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
基于与发送端执行的数据传输方法相同的发明构思,本申请实施例还提供了一种数据传输装置,如图6所示,包括:
分包模块610,用于从队列中提取存储的数据,组装成上限为设定长 度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;
添加模块620,用于在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;其中,接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出提交给上层。
基于与接收端执行的数据传输方法相同的发明构思,本申请实施例还提供了一种数据传输装置,如图7所示,包括:
接收模块710,用于接收发送端从队列中提取存储的数据;其中,所述数据组装成上限为设定长度的数据的数据包,并将超出所述设定长度部分的剩余数据缓存在缓存队列中,在下一次组装数据包时,将所述缓存队列中的数据添加至数据包中,并与当次发送数据发送;
回调模块720,用于接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
请参考图8,图8为一个实施例中计算机设备的内部结构示意图。如图8所示,该计算机设备包括通过***总线连接的处理器810、存储介质820、存储器830和网络接口840。其中,该计算机设备的存储介质820存储有操作***、数据库和计算机可读指令,数据库中可存储有控件信息序列,该计算机可读指令被处理器810执行时,可使得处理器810实现一种数据传输方法,处理器810能实现图5所示实施例中的一种数据传输***中的发送模块510、分别模块520和接收模块530的功能,或者是一种数据传输装置中的分包模块610和添加620的功能,或者是一种数据传输装置中的接收模块710和回调模块720的功能。该计算机设备的处理器810用于提供计算和控制能力,支撑整个计算机设备的运行。该计算机设备的存储器830中可存储有计算机可读指令,该计算机可读指令被处理器1执行时,可使得处理器810执行一种数据传输方法。该计算机设备的网络接口840用于与终端连接通信。本领域技术人员可以理解,图8中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。
在一个实施例中,本申请还提出了一种存储有计算机可读指令的存储介质,该计算机可读指令被一个或多个处理器执行时,使得一个或多个处理器执行以下步骤:发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
综合上述实施例可知,本申请最大的有益效果在于:
本申请提供的一种数据传输方法,解决了在数据在发送端和接收端的数据组成和分配不合理从而影响数据的传输的问题。在数据传输的过程中,通过对数据在发送端设置上限组装分包,以及在接收端进行缓存,并根据来自同一协议包的数据包进行组包,使得传输数据可以得到合理的分包和快速地组包,提高了数据传输的效率。
进一步地,所述发送端和接收端分别对各自正在处理的数据进行超时判断,若超时,对相应的数据或数据包B-Pack进行丢弃,从而解决了传统的全可靠的传输技术在超时后还继续传输所容易增加网络负担的问题。进一步地,为了解决发送端和接收端位于不同设备对时难的问题,接收端还将其所接收的数据包中产生最晚生成时间设定为最大时间戳,以该最大时间戳与数据包对应的超时时长进行对比,判对应的数据包是否超时。进一步地,为了在有限的网络资源中对重要的数据进行有效传输,发送端对数据的发送之前,对数据组成的队列进行优先级的排序,并根据所述优先级进行组装分包,然后再进行传输。同时,在接收端处,根据数据包B-Pack的协议标记p_id,对所述数据包B-Pack进行组包并上传或者丢弃,使数据包能够快速组成一个完整的协议包并上传,完成数据传输。
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,该计算机程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等存储介质,或随机存储记忆体(Random Access Memory,RAM)等。
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。
Claims (27)
- 一种数据传输方法,包括以下步骤:发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
- 根据权利要求1所述的方法,其特征在于,所述队列包括第一队列和第二队列,其中,第一队列的优先级高于第二队列,对应有第一缓存队列和第二缓存队列;发送端按优先级组装相应的数据包并发送给接收端。
- 根据权利要求1所述的方法,其特征在于,所述接收端接收数据包,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包的步骤包括:所述接收端设有临时存储列表,用于在接收到数据包时,进行临时存储;直到收到的多个数据包组成一个完整的协议包,将相关的数据包取出,组成一个完整的协议包;其中,同一个协议包的多个数据包共用一个协议标记,每个协议标记作为索引,每个索引对应有一个存储列表,同一协议标记的多个数据包存放至一个存储列表中。
- 根据权利要求3所述的方法,其特征在于,所述接收端设有临时存储列表,用于在接收到数据包时,进行临时存储的步骤之后,还包括:根据数据包的所述索引进行组装,将接收到的数据包***到存储列表中,进行组包。
- 根据权利要求1所述的方法,其特征在于,所述发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端的步骤还包括:判断数据是否超过传输的超时时长;当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃。
- 根据权利要求5所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:在组装成上限为设定长度的数据的数据包的步骤之前,还包括:调用发送窗口;若调用所述发送窗口时长超过所述超时时长,发送端对对应的数据进行丢弃。
- 根据权利要求5所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:所述组装成上限为设定长度的数据的数据包的步骤之后,检测当前发送时长是否超过超时时长;若是,发送端将对应的数据包丢弃;否则,继续进行重传。
- 根据权利要求5所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:检测接收端接收到所述数据包的时长是否超过超时时长;若是,对对应的数据包进行丢弃。
- 根据权利要求5所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:定期检测接收端接收到进行缓存的数据包的时长是否超过所述超时时长;若检测到所述数据包超过超时时长且未组成完整的协议包,提取属于相同协议的数据包,并进行丢弃。
- 根据权利要求5所述的方法,其特征在于,所述数据包包括其数据包的生成时间;将接收端所接收的数据包中产生最晚时间设定为最大时间戳,若数据包的超时时长小于所述最大时间戳,则对应的数据包超时。
- 一种数据传输方法,包括以下步骤:从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;其中,接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
- 根据权利要求11所述的方法,其特征在于,所述队列包括第一队列和第二队列,其中,第一队列的优先级高于第二队列,对应有第一缓存队列和第二缓存队列;按优先级组装相应的数据包并发送给接收端。
- 根据权利要求11所述的方法,其特征在于,所述从队列中提取存储的数据,组装成上限为设定长度的数据的数据 包,发送至接收端的步骤还包括:判断数据是否超过传输的超时时长;当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃。
- 根据权利要求13所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:在组装成上限为设定长度的数据的数据包的步骤之前,还包括:调用发送窗口;若调用所述发送窗口时长超过所述超时时长,对对应的数据进行丢弃。
- 根据权利要求13所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:所述组装成上限为设定长度的数据的数据包的步骤之后,检测当前发送时长是否超过超时时长;若是,将对应的数据包丢弃;否则,继续进行重传。
- 一种数据传输方法,包括以下步骤:接收发送端从队列中提取存储的数据;其中,所述数据组装成上限为设定长度的数据的数据包,并将超出所述设定长度部分的剩余数据缓存在缓存队列中,在下一次组装数据包时,将所述缓存队列中的数据添加至数据包中,并与当次发送数据发送;接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
- 根据权利要求16所述的方法,其特征在于,所述接收端接收数据包,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包的步骤包括:所述接收端设有临时存储列表,用于在接收到数据包时,进行临时存储;直到收到的多个数据包组成一个完整的协议包,将相关的数据包取出,组成一个完整的协议包;其中,同一个协议包的多个数据包共用一个协议标记,每个协议标记作为索引,每个索引对应有一个存储列表,同一协议标记的多个数据包存放至一个存储列表中。
- 根据权利要求17所述的方法,其特征在于,所述接收端设有临时存储列表,用于在接收到数据包时,进行临时存储的步骤之后,还包括:根据数据包的所述索引进行组装,将接收到的数据包***到存储列表中,进行组包。
- 根据权利要求16所述的方法,其特征在于,所述接收发送端从队列中提取存储的数据的步骤包括:判断数据是否超过传输的超时时长;当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃。
- 根据权利要求19所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:检测到接收的所述数据包的时长是否超过超时时长;若是,对对应的数据包进行丢弃。
- 根据权利要求19所述的方法,其特征在于,所述当检测到数据超过其对应的所述超时时长时,对所述数据进行丢弃的步骤包括:定期检测接收到进行缓存的数据包的时长是否超过所述超时时长;若检测到所述数据包超过超时时长,提取属于相同协议的数据包,并进行丢弃。
- 根据权利要求19所述的方法,其特征在于,所述数据包还包括其数据包的生成时间;将接收到的数据包中产生最晚生成时间设定为最大时间戳,若数据包的超时时长小于所述最大时间戳,则对应的数据包超时。
- 一种数据传输***,包括:发送模块,用于发送端从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;分包模块,用于在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;接收模块,用于接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
- 一种数据传输装置,括:分包模块,用于从队列中提取存储的数据,组装成上限为设定长度的数据的数据包,发送至接收端,并将超出所述设定长度部分的剩余数据缓存在缓存队列中;添加模块,用于在下一次组装数据包时,将所述缓存队列中的数据添加到数据包中,并与当次发送数据发送至接收端;其中,接收端接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出提交给上层。
- 一种数据传输装置,包括:接收模块,用于接收发送端从队列中提取存储的数据;其中,所述数据组装成上限为设定长度的数据的数据包,并将超出所述设定长度部分的 剩余数据缓存在缓存队列中,在下一次组装数据包时,将所述缓存队列中的数据添加至数据包中,并与当次发送数据发送;回调模块,用于接收数据包后,对所述数据包进行缓存,直至接收到的多个数据包组成完整的协议包时,将相应的数据包取出并向上层回调。
- 一种计算机设备,包括:一个或多个处理器;存储器;一个或多个应用程序,其中所述一个或多个应用程序被存储在所述存储器中并被配置为由所述一个或多个处理器执行,所述一个或多个程序配置用于:执行根据权利要求1~~22任一项所述的数据传输方法。
- 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机程序,该计算机程序被处理器执行时实现权利要求1~~22任一项所述的数据传输方法。
Applications Claiming Priority (2)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811641443.3A CN111385269B (zh) | 2018-12-29 | 2018-12-29 | 数据传输方法和装置 |
CN201811641443.3 | 2018-12-29 |
Publications (1)
Publication Number | Publication Date |
---|---|
WO2020134755A1 true WO2020134755A1 (zh) | 2020-07-02 |
Family
ID=71126581
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
PCT/CN2019/120037 WO2020134755A1 (zh) | 2018-12-29 | 2019-11-21 | 数据传输方法和装置 |
Country Status (2)
Country | Link |
---|---|
CN (1) | CN111385269B (zh) |
WO (1) | WO2020134755A1 (zh) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111865827A (zh) * | 2020-08-31 | 2020-10-30 | 上海兆芯集成电路有限公司 | 数据链路层设备及其组包方法 |
CN112738229A (zh) * | 2020-12-29 | 2021-04-30 | 北京航天自动控制研究所 | 一种实现数据自动续传的通信方法 |
CN113595932A (zh) * | 2021-08-06 | 2021-11-02 | 上海金仕达软件科技有限公司 | 数据乱序报文的处理方法及专用集成电路 |
Families Citing this family (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN112615732A (zh) * | 2020-12-04 | 2021-04-06 | 浪潮电子信息产业股份有限公司 | 基于简单网络管理协议的信息发送方法、***及相关装置 |
CN114124850B (zh) * | 2022-01-26 | 2022-07-12 | 浙江宇视***技术有限公司 | 一种网络通信方法及装置、存储介质 |
CN115134320B (zh) * | 2022-08-25 | 2023-01-03 | 四川汉唐云分布式存储技术有限公司 | 一种基于消息分发确定时序的交易*** |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6714562B1 (en) * | 2000-03-10 | 2004-03-30 | International Business Machines Corporation | Method and apparatus for segmenting network traffic variable length frames |
CN104506868A (zh) * | 2014-12-31 | 2015-04-08 | 深圳市大疆创新科技有限公司 | 视频码流传输方法,装置及*** |
CN105656507A (zh) * | 2016-03-24 | 2016-06-08 | 中国电子科技集团公司第三十四研究所 | 一种无线光与射频混合通信***及使用方法 |
Family Cites Families (13)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
EP1526701A1 (en) * | 2003-10-22 | 2005-04-27 | Mitsubishi Denki Kabushiki Kaisha | Methods and devices for transferring and for recovering data packets |
CN1816042A (zh) * | 2005-01-31 | 2006-08-09 | 华为技术有限公司 | 一种处理器间数据传输方法 |
CN101388900B (zh) * | 2007-09-12 | 2014-05-28 | 电信科学技术研究院 | 一种协议数据单元填充的处理方法、装置及*** |
WO2009155983A1 (en) * | 2008-06-26 | 2009-12-30 | Nokia Siemens Networks Oy | Charging for short message delivery |
CN101577709A (zh) * | 2008-08-06 | 2009-11-11 | 中兴通讯股份有限公司 | 一种可避免分片的ip分组复用控制方法及设备 |
CN101488967B (zh) * | 2009-01-14 | 2015-05-13 | 深圳市同洲电子股份有限公司 | 一种视频传输方法、嵌入式监控终端及监控平台服务器 |
CN101640636A (zh) * | 2009-07-31 | 2010-02-03 | 北京师范大学 | 一种4over6隧道中避免报文重组的方法及*** |
CN101931919B (zh) * | 2010-08-18 | 2013-03-20 | 中国电信股份有限公司 | 长短信发送处理方法与装置、业务网关及通信*** |
CN102025638A (zh) * | 2010-12-21 | 2011-04-20 | 福建星网锐捷网络有限公司 | 基于优先级的数据传输方法、装置及网络设备 |
CN102665140B (zh) * | 2012-05-16 | 2014-04-09 | 哈尔滨工业大学深圳研究生院 | 一种avs视频帧的rtp封装方法 |
CN103533075B (zh) * | 2013-10-23 | 2017-05-03 | 中国科学院声学研究所 | 将数据导入iSCSI目标器的方法和iSCSI启动器 |
CN105790887A (zh) * | 2014-12-26 | 2016-07-20 | 上海贝尔股份有限公司 | 用于为分组生成并行crc值的方法和设备 |
CN108282246B (zh) * | 2017-01-05 | 2023-09-01 | 华为技术有限公司 | 信息处理的方法、设备和通信*** |
-
2018
- 2018-12-29 CN CN201811641443.3A patent/CN111385269B/zh active Active
-
2019
- 2019-11-21 WO PCT/CN2019/120037 patent/WO2020134755A1/zh active Application Filing
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US6714562B1 (en) * | 2000-03-10 | 2004-03-30 | International Business Machines Corporation | Method and apparatus for segmenting network traffic variable length frames |
CN104506868A (zh) * | 2014-12-31 | 2015-04-08 | 深圳市大疆创新科技有限公司 | 视频码流传输方法,装置及*** |
CN105656507A (zh) * | 2016-03-24 | 2016-06-08 | 中国电子科技集团公司第三十四研究所 | 一种无线光与射频混合通信***及使用方法 |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111865827A (zh) * | 2020-08-31 | 2020-10-30 | 上海兆芯集成电路有限公司 | 数据链路层设备及其组包方法 |
CN111865827B (zh) * | 2020-08-31 | 2023-10-27 | 上海兆芯集成电路股份有限公司 | 数据链路层设备及其组包方法 |
CN112738229A (zh) * | 2020-12-29 | 2021-04-30 | 北京航天自动控制研究所 | 一种实现数据自动续传的通信方法 |
CN112738229B (zh) * | 2020-12-29 | 2022-08-12 | 北京航天自动控制研究所 | 一种实现数据自动续传的通信方法 |
CN113595932A (zh) * | 2021-08-06 | 2021-11-02 | 上海金仕达软件科技有限公司 | 数据乱序报文的处理方法及专用集成电路 |
CN113595932B (zh) * | 2021-08-06 | 2024-05-14 | 上海金仕达软件科技股份有限公司 | 数据乱序报文的处理方法及专用集成电路 |
Also Published As
Publication number | Publication date |
---|---|
CN111385269B (zh) | 2021-02-12 |
CN111385269A (zh) | 2020-07-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
WO2020134755A1 (zh) | 数据传输方法和装置 | |
CN109327288B (zh) | 数据传输加速方法、装置及*** | |
CN103036904B (zh) | 一种在通信网络中使用udp协议进行数据可靠传输的方法 | |
CN111512603A (zh) | 一种数据传输方法及第一设备 | |
US7411959B2 (en) | System and method for handling out-of-order frames | |
CN104168081B (zh) | 一种文件传输方法及装置 | |
WO2017050216A1 (zh) | 一种报文传输方法及用户设备 | |
WO2016192478A1 (zh) | 数据传输方法及装置 | |
CN109936510A (zh) | 多路径rdma传输 | |
CN104168093B (zh) | 一种文件传输方法及装置 | |
US20110032941A1 (en) | Systems and methods for accelerating tcp/ip data stream processing | |
CN105376173B (zh) | 一种发送窗口流量控制方法和终端 | |
US10009445B2 (en) | Avoiding unwanted TCP retransmissions using optimistic window adjustments | |
US20120054362A1 (en) | Mechanism for autotuning mass data transfer from a sender to a receiver over parallel connections | |
CN103986647A (zh) | 报文传输方法及设备 | |
CN109462857A (zh) | 丢包处理方法、装置、无线网元及计算机可读存储介质 | |
CN111970092B (zh) | 一种支持可靠性调节的多协议冗余网络异步通信方法 | |
CN111163362B (zh) | 一种自适应重传等待时间的视频接收方法及*** | |
US20060004933A1 (en) | Network interface controller signaling of connection event | |
EP1460804A2 (en) | System and method for handling out-of-order frames (fka reception of out-of-order tcp data with zero copy service) | |
EP2685658A1 (en) | Technique for handling a data packet stream | |
RU2715016C1 (ru) | Передающее устройство, способ, программа и носитель записи | |
CN112367265B (zh) | 一种适用于窄带弱连接网络的可靠数据传输方法和装置 | |
US20160013892A1 (en) | Communication apparatus, reception apparatus, and transmission apparatus | |
CN1848976A (zh) | 一种短消息重发方法及短消息重发*** |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
121 | Ep: the epo has been informed by wipo that ep was designated in this application |
Ref document number: 19905434 Country of ref document: EP Kind code of ref document: A1 |
|
NENP | Non-entry into the national phase |
Ref country code: DE |
|
122 | Ep: pct application non-entry in european phase |
Ref document number: 19905434 Country of ref document: EP Kind code of ref document: A1 |