[go: up one dir, main page]

CN110299971B - Data message receiving method and device - Google Patents

Data message receiving method and device Download PDF

Info

Publication number
CN110299971B
CN110299971B CN201810246182.9A CN201810246182A CN110299971B CN 110299971 B CN110299971 B CN 110299971B CN 201810246182 A CN201810246182 A CN 201810246182A CN 110299971 B CN110299971 B CN 110299971B
Authority
CN
China
Prior art keywords
data packet
data
transmission
packet
check
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810246182.9A
Other languages
Chinese (zh)
Other versions
CN110299971A (en
Inventor
李东声
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tendyron Corp
Original Assignee
Tendyron Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tendyron Corp filed Critical Tendyron Corp
Priority to CN201810246182.9A priority Critical patent/CN110299971B/en
Publication of CN110299971A publication Critical patent/CN110299971A/en
Application granted granted Critical
Publication of CN110299971B publication Critical patent/CN110299971B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/004Arrangements for detecting or preventing errors in the information received by using forward error control
    • H04L1/0056Systems characterized by the type of code used
    • H04L1/0061Error detection codes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1806Go-back-N protocols
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1829Arrangements specially adapted for the receiver end
    • H04L1/1835Buffer management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end
    • H04L1/187Details of sliding window management
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end
    • H04L1/189Transmission or retransmission of more than one copy of a message

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Communication Control (AREA)

Abstract

The invention provides a method and a device for receiving a data message, wherein the method comprises the following steps: presetting S cache units, and numbering the S cache units in sequence; receiving transmission data packets, wherein the transmission data packets comprise Q data packets, and the packet head of each data packet at least comprises the serial number of the data packet and a data packet check value; calculating the packet check comparison value of each data packet by one of the following methods: carrying out verification calculation on the serial number and the data of the data packet to obtain a data packet verification comparison value; or, carrying out check calculation on the data of the data packet to obtain a data packet check comparison value; and comparing the data packet check value of each data packet with the data packet check comparison value, if the data packet check value and the data packet check comparison value are consistent, sequentially judging whether the data packets are stored in the cache units corresponding to the numbers of the Q data packets, storing the data packets corresponding to the numbers of the cache units in the cache units which do not store the data packets, and discarding the data packets corresponding to the numbers of the cache units which store the data packets.

Description

Data message receiving method and device
Technical Field
The present invention relates to the field of electronic technologies, and in particular, to a method and an apparatus for receiving a data message.
Background
In the existing network data transmission, each time a transmission layer transmits a data packet, a receiving end returns a corresponding ACK (Acknowledgement) response to the successfully received data packet; if the sender does not receive the ACK response within a reasonable Round-Trip Time (RTT), the corresponding packet is assumed to be lost and will be retransmitted. Under the existing communication protocol, after a sending end sends a data packet, the sending end needs to wait for an ACK response sent by a receiving end before continuing to send the next data packet, and the sending end and the receiving end need to have data interaction once, although the reliability is strong, the transmission efficiency is low. Moreover, under the condition of poor network conditions, the data can be retransmitted for many times, the use is unstable, and network resources are wasted.
Disclosure of Invention
The present invention aims to solve one of the above problems.
The invention mainly aims to provide a data transmission method.
Another object of the present invention is to provide a data transmission apparatus.
Another object of the present invention is to provide a data message receiving method.
Another object of the present invention is to provide a data message receiving apparatus.
In order to achieve the purpose, the technical scheme of the invention is realized as follows:
one aspect of the present invention provides a data transmission method, including: acquiring a message to be transmitted, wherein the message to be transmitted consists of N data packets; the N data packets are numbered in sequence, and the serial numbers of the data packets and the data of the data packets are checked and calculated to obtain a data packet check value of each data packet; or, carrying out check calculation on the data of each data packet to obtain a data packet check value of each data packet, and numbering the N data packets in sequence; the header of each data packet at least comprises a number distributed to the data packet and a data packet check value calculated for the data packet; determining the length of a transmission data window, wherein the length of the transmission data window is used for determining the number M of data packets contained in one transmission data packet, M, N is a positive integer, and M is less than or equal to N; sending the message to be transmitted according to the following steps: a.i is 1, wherein i is the number of times of sending the current transmission data packet, and the value of i is 1,2,3 … …, N-M + 1; B. placing the initial position of the transmission data window at a data packet with the number i; selecting an ith transmission data packet to be sent according to the length of the transmission data window, wherein the ith transmission data packet to be sent comprises M data packets numbered from i to i + M-1, and sending the ith transmission data packet to be sent; C. judging whether i +1 is less than or equal to N-M +1, if so, changing i to i +1, and returning to the step B; and if not, finishing sending the message to be transmitted.
Optionally, the ith transmission data packet to be sent further includes: a transmission packet check value and the number of each data packet of a transmission data packet received at the kth time, wherein k is a positive integer; before the sending of the transmission data packet to be sent for the ith time, the method further includes: and carrying out verification calculation on the data of each data packet of the ith to-be-transmitted transmission data packet and the data of each data packet of the kth received transmission data packet to obtain the transmission packet verification value.
Optionally, after sending the transmission data packet to be sent for the ith time, the method further includes: receiving a retransmission request, wherein the retransmission request at least comprises the number n of a data packet to be retransmitted, and n is not more than i; placing the initial position of the transmission data window at a data packet with the number of n; and selecting a transmission data packet to be retransmitted according to the length of the transmission data window, wherein the transmission data packet to be retransmitted for the nth time comprises M data packets numbered from n to n + M-1, and transmitting the transmission data packet to be retransmitted.
Optionally, the message to be transmitted is a UDP message, and before the obtaining of the message to be transmitted, the method further includes: and dividing the message to be transmitted into the N data packets according to a preset strategy.
Optionally, the transmission data packet to be sent for the ith time further includes a UDP pseudo header and a UDP header; the UDP header includes: checking the sum; before the sending of the transmission data packet to be sent for the ith time, the method further includes: and calculating to obtain the checksum according to the UDP pseudo-header, the UDP header and the data of the M data packets of the ith to-be-transmitted transmission data packet.
Another aspect of the present invention provides a data transmitting apparatus, including: the device comprises an acquisition module, a transmission module and a transmission module, wherein the acquisition module is used for acquiring a message to be transmitted, and the message to be transmitted consists of N data packets; the data packet processing module is used for numbering the N data packets in sequence, and carrying out check calculation on the numbers of the data packets and the data of the data packets to obtain a data packet check value of each data packet; or, carrying out check calculation on the data of each data packet to obtain a data packet check value of each data packet, and numbering the N data packets in sequence; the header of each data packet at least comprises a number distributed to the data packet and a data packet check value calculated for the data packet; a transmission data window configuration module, configured to determine a length of a transmission data window, where the length of the transmission data window is used to determine the number M of data packets included in one transmission data packet, M, N is a positive integer, and M is less than or equal to N; a sending module, configured to send the packet to be transmitted according to the following steps: a.i is 1, wherein i is the number of times of sending the current transmission data packet, and the value of i is 1,2,3 … …, N-M + 1; B. placing the initial position of the transmission data window at a data packet with the number i; selecting an ith transmission data packet to be sent according to the length of the transmission data window, wherein the ith transmission data packet to be sent comprises M data packets numbered from i to i + M-1; transmitting the transmission data packet to be transmitted for the ith time; C. judging whether i +1 is less than or equal to N-M +1, if so, changing i to i +1, and returning to the step B; and if not, finishing sending the message to be transmitted.
Optionally, the ith transmission data packet to be sent further includes: a transmission packet check value and the number of each data packet of a transmission data packet received at the kth time, wherein k is a positive integer; the data packet processing module is further configured to, before the sending module sends the ith transmission data packet to be sent, perform check calculation on data of each data packet of the ith transmission data packet to be sent and data of each data packet of the kth received transmission data packet to obtain the transmission packet check value.
Optionally, the apparatus further comprises: a receiving module, wherein: the receiving module is used for receiving a retransmission request, wherein the retransmission request at least comprises the number n of a data packet to be retransmitted, and n is less than or equal to i; the sending module is further configured to place the start position of the transmission data window at the data packet numbered n; and selecting a transmission data packet to be retransmitted according to the length of the transmission data window, wherein the transmission data packet to be retransmitted comprises M data packets numbered from n to n + M-1, and sending the transmission data packet to be retransmitted.
Optionally, the apparatus further comprises: and the message processing module is used for dividing the message to be transmitted into the N data packets according to a preset strategy.
Optionally, the transmission data packet to be sent for the ith time includes a UDP pseudo header and a UDP header; the UDP header includes: checking the sum; the data packet processing module is further configured to calculate the checksum according to the UDP pseudo header, the UDP header, and the data of the M data packets of the ith to-be-transmitted transmission data packet.
Another aspect of the present invention provides a method for receiving a data message, including: presetting S cache units, and numbering the S cache units in sequence, wherein one cache unit is used for storing one data packet; receiving transmission data packets, wherein the transmission data packets comprise Q data packets, the packet head of each data packet at least comprises the serial number of the data packet and a data packet check value, S, Q is a positive integer, and Q is less than or equal to S; calculating the packet check comparison value of each data packet by one of the following methods: carrying out check calculation on the serial number of the data packet and the data of the data packet to obtain a check comparison value of the data packet; or, carrying out check calculation on the data of the data packet to obtain a check comparison value of the data packet; comparing the data packet check value of each data packet with the data packet check comparison value, if the data packet check value of each data packet is consistent with the data packet check comparison value, sequentially judging whether the data packets are stored in the cache units corresponding to the numbers of the Q data packets, storing the data packets corresponding to the numbers of the cache units in which the data packets are not stored, and discarding the data packets corresponding to the numbers of the cache units in which the data packets are stored.
Optionally, the transmitting data packet further includes: the transmission packet check value and the number of each data packet of the transmission data packet sent at the kth time; after receiving the transmission data packet, before storing the data packet corresponding to the number thereof in the buffer unit which does not store the data packet, the method further comprises: acquiring each data packet of the transmission data packet sent at the kth time according to the number of each data packet of the transmission data packet sent at the kth time; carrying out verification calculation on the data of the Q data packets and the data of each data packet of the transmission data packet sent at the kth time to obtain a transmission packet verification comparison value of the transmission data packet; and comparing the transmission packet check value with the transmission packet check comparison value, if the transmission packet check value is consistent with the transmission packet check comparison value, the check is passed, and the step of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet is executed.
Optionally, after receiving the transmission data packet, the method further includes: judging whether n is satisfied1=n2+1, wherein n1Is the smallest number, n, of the numbers of the Q data packets2The number is the minimum number in the numbers of the cache units which do not store the data packets; if yes, sending a retransmission request to a sending end, wherein the retransmission request comprises the number n of the data packet requesting retransmission2
Optionally, the transport packet further includes a UDP dummy header and a UDP header; the UDP header includes: checking the sum; after receiving the transmission data packet, before storing the data packet corresponding to the number thereof in the buffer unit which does not store the data packet, the method further comprises: calculating to obtain a comparison check sum of the transmission data packet according to the UDP pseudo header, the UDP header and the Q data packets; and comparing the checksum of the transmission data packet with the comparison checksum, if the checksum is consistent with the comparison checksum, passing the verification, and executing the step of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet.
Another aspect of the present invention provides a data message receiving apparatus, including: s buffer memory unit, buffer memory unit processing module, receiving module, data packet processing module and control module, wherein: the cache unit processing module is used for numbering the S cache units in sequence, wherein one cache unit is used for storing one data packet; the receiving module is used for receiving transmission data packets, wherein the transmission data packets comprise Q data packets, the packet header of each data packet at least comprises the serial number of the data packet, S, Q is a positive integer, and Q is less than or equal to S; the data packet processing module is used for calculating the data packet check comparison value of each data packet in one of the following modes: carrying out check calculation on the serial number of the data packet and the data of the data packet to obtain a check comparison value of the data packet; or, carrying out check calculation on the data of the data packet to obtain a check comparison value of the data packet; the control module is used for comparing the data packet check value of each data packet with the data packet check comparison value, if the data packet check value of each data packet is consistent with the data packet check comparison value, sequentially judging whether the data packets are stored in the cache units corresponding to the numbers of the Q data packets, storing the data packets corresponding to the numbers of the data packets in the cache units which do not store the data packets, and discarding the data packets corresponding to the numbers of the cache units which store the data packets.
Optionally, the transmitting data packet further includes: the transmission packet check value and the number of each data packet of the transmission data packet sent at the kth time; the data packet processing module is further configured to obtain each data packet of the transmission data packet sent for the kth time according to the number of each data packet of the transmission data packet sent for the kth time; carrying out verification calculation on the data of the Q data packets and the data of each data packet of the transmission data packet sent at the kth time to obtain a transmission packet verification comparison value of the transmission data packet; the control module is further configured to compare the transmission packet check value with the transmission packet check comparison value, and if the transmission packet check comparison value is consistent with the transmission packet check comparison value, the check is passed, and the operation of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet is executed.
Optionally, the apparatus further includes a sending module, wherein: the control module is also used for judging whether n is satisfied1=n2+1, if yes, controlling the sending module to send a retransmission request to the sending end; wherein n is1Is the smallest number, n, of the numbers of the Q data packets2The number is the minimum number in the numbers of the cache units which do not store the data packets; the sending module is configured to send the retransmission request to the sending end, where the retransmission request includes a number n of a data packet requested to be retransmitted2
Optionally, the transport packet further includes a UDP dummy header and a UDP header; the UDP header includes: checking the sum; the data packet processing module is further configured to calculate a comparison checksum of the transmission data packet according to the UDP pseudo header, the UDP header, and the Q data packets; the control module is further configured to compare the comparison checksum and the checksum of the transmission data packet, and if the comparison checksum and the checksum are consistent, the check is passed, and the step of storing the data packet corresponding to the serial number in the cache unit where the data packet is not stored is executed.
According to the technical scheme provided by the invention, the data packet receiving method and the device provided by the invention have the advantages that the data packet and the cache unit are correspondingly numbered, the same data packet can be repeatedly received for many times, the data packet is stored in the corresponding cache unit according to the number, and when a certain data packet generates transmission errors or packet loss in the transmission process, the data packet can be repeatedly received for many times, so that the packet loss of the data packet can be avoided to the maximum extent, and the retransmission probability is reduced. In addition, the receiving end does not need to return an ACK response in the transmission process, and the sending end does not need to wait for the ACK response returned by the receiving end, so that the interaction between the sending end and the receiving end can be reduced, the efficiency of data transmission is improved, and the risk of packet loss possibly caused by the fact that interactive feedback is not needed can be reduced.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on the drawings without creative efforts.
Fig. 1 is a flowchart of a data transmission method according to embodiment 1 of the present invention;
fig. 2 is a schematic diagram of a format of a packet header of a data packet according to embodiment 1 of the present invention;
fig. 3 is a schematic diagram of determining a transmission data packet in a transmission data window according to embodiment 1 of the present invention;
fig. 4 is a schematic diagram of a format of a UDP transport packet according to embodiment 1 of the present invention;
fig. 5 is a flowchart of a data packet receiving method according to embodiment 2 of the present invention;
fig. 6 is a schematic structural diagram of a data transmission system according to embodiment 3 of the present invention;
fig. 7 is a schematic structural diagram of a data transmission apparatus according to embodiment 3 of the present invention;
fig. 8 is a schematic structural diagram of a data packet receiving apparatus according to embodiment 3 of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention.
In the description of the present invention, it is to be understood that the terms "center", "longitudinal", "lateral", "up", "down", "front", "back", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", and the like, indicate orientations or positional relationships based on those shown in the drawings, and are used only for convenience in describing the present invention and for simplicity in description, and do not indicate or imply that the referenced devices or elements must have a particular orientation, be constructed and operated in a particular orientation, and thus, are not to be construed as limiting the present invention. Furthermore, the terms "first," "second," and the like are used for descriptive purposes only and are not to be construed as indicating or implying a relative importance or quantity or location.
In the description of the present invention, it should be noted that, unless otherwise explicitly specified or limited, the terms "mounted," "connected," and "connected" are to be construed broadly, e.g., as meaning either a fixed connection, a removable connection, or an integral connection; can be mechanically or electrically connected; they may be connected directly or indirectly through intervening media, or they may be interconnected between two elements. The specific meanings of the above terms in the present invention can be understood in specific cases to those skilled in the art.
Embodiments of the present invention will be described in further detail below with reference to the accompanying drawings.
Example 1
The embodiment provides a data transmission method. As shown in fig. 1, the data transmission method includes the steps (S101-S105) of:
s101, obtaining a message to be transmitted, wherein the message to be transmitted consists of N data packets;
in this embodiment, the message to be transmitted may be a TCP/IP Protocol message, or may also be a User Datagram Protocol (UDP) message. The message to be transmitted can be divided into N data packets, where N is a positive integer.
Among existing UDP transport protocols, the UDP protocol is a connectionless transport layer protocol in an Open System Interconnection (OSI) reference model, and provides a simple and unreliable information transfer service. In the network it is used to process UDP packets as well as the TCP/IP protocol. However, UDP does not provide for packet grouping, packing, and packet ordering, i.e., after a packet is sent, it cannot be known whether it arrives safely and completely. The UDP protocol cannot guarantee that the data packet can be accurately transmitted to the receiving end, and the receiving end does not need to confirm the received UDP packet. In this embodiment, when the message to be transmitted is a UDP message, as an optional implementation manner, before obtaining the message to be transmitted, the method provided in this embodiment further includes: and dividing the message to be transmitted into N data packets according to a preset strategy. For example, the packet size may be set according to the maximum capacity of the packets allowed to be transmitted by the network, and the packet to be transmitted may be divided. For another example, the value of N may be set, for example, to 100, and the message to be transmitted is divided into 100 data packets with the same size. For another example, the packet to be transmitted is divided according to a preset algorithm in combination with the current stable state of the network. The dividing method of the packet to be transmitted in this embodiment is not particularly limited, as long as the packet to be transmitted can be divided into a plurality of data packets, and the transmission of the data packet is completed in a manner of sending the data packets.
S102, numbering N data packets in sequence, wherein the packet head of each data packet at least comprises a number distributed to the packet head;
in this embodiment, after a packet to be transmitted, which is composed of N data packets, is obtained, the N data packets are numbered sequentially, and the number of the N data packets is 1,2, … …, N in order to perform iterative sending of the data packets according to the numbers, thereby implementing multiple sending of one data packet, reducing the probability of retransmission, reducing the risk of packet loss that may be caused by no need of interactive feedback in the transmission process, and improving the efficiency of data transmission.
In this embodiment, when the packet to be transmitted is a UDP packet, different from the existing UDP transmission protocol, the embodiment performs packet packetization on the UDP packet to be transmitted, allocates a number to each UDP packet, and sends the UDP packet to be transmitted in a manner as described in step S104 below. In this embodiment, the receiving end does not need to confirm the received UDP data packet, but the same UDP data packet is repeatedly transmitted many times, so that the data packet can be accurately transmitted to the receiving end, and the probability of retransmission is reduced.
A data packet includes a packet header and data, where the packet header at least includes a number allocated to the data packet, and the number can uniquely identify the data packet, and both the sending end and the receiving end can identify the data packet according to the number, for example, the receiving end can carry the number of the data packet that has not been received in a retransmission request sent to the sending end, and the sending end can retransmit the corresponding data packet according to the number. As an alternative, the format of the packet header is shown in fig. 2, and the packet header may include: source port, destination port, number, packet length, and check value. The packet header shown in fig. 2 is only an optional embodiment, and the packet header may be added or subtracted according to specific needs.
S103, carrying out check calculation on the serial number of the data packet and the data of the data packet to obtain a data packet check value of each data packet; or, carrying out check calculation on the data of each data packet to obtain a data packet check value of each data packet, and numbering the N data packets in sequence; the header of each data packet at least comprises a number distributed to the data packet and a data packet check value calculated for the data packet;
in this embodiment, a plurality of ways of calculating the check value of the data packet are provided, that is, the number and the data of the data packet may be subjected to check calculation, and the data of the data packet may also be subjected to check calculation, so that the check value of the data packet of each data packet is finally calculated. The specific Check calculation algorithm is not limited in this embodiment, and for example, the Check value of the data packet may be calculated by using an algorithm such as parity Check or Cyclic Redundancy Check (CRC). By sending the data packet carrying the check value, the receiving end can check the data packet by using a corresponding algorithm after receiving the data packet in the transmission data packet, so as to ensure the integrity and the security of the received data packet (i.e., ensure that the received data packet is not tampered).
S104, determining the length of a transmission data window, wherein the length of the transmission data window is used for determining the number M of data packets contained in one transmission data packet, M is a positive integer and is less than or equal to N;
in this embodiment, the sending end sends one transmission data packet at a time until all the N data packets of the obtained message to be transmitted are sent. The number M of data packets included in each transmission data packet is determined by the length of the transmission data window, and the data packets covered by the transmission data window, that is, the data packets in the window are the M data packets included in the transmission data packet that needs to be sent this time. The number of M may be determined according to the carrying capacity of the network transmission capability and the stability of the current data transmission. The larger the value of M is, the higher the requirement on network transmission is, and the lower the packet loss rate is. As an alternative, the numbers of M packets in each transport packet are sequentially incremented, for example, M is 3, the numbers of the packets in the 1 st transport packet are 1,2 and 3, the numbers of the packets in the 2 nd transport packet are 2,3, 4 and … … until the number of the last transport packet is N-2, N-1 and N. The window floats back once after each transmission of a transmission packet. Fig. 3 only exemplarily shows a schematic diagram that a transmission data window determines one transmission data packet, where a header of each data packet at least includes a number of the data packet, and a packet to be transmitted includes N data packets numbered in sequence. Of course, the numbers of the M packets are also sequentially decremented. Alternatively, the transmission data window may be floated forward once after each transmission of a transmission data packet. As long as iterative transmission of data packets can be achieved.
S105, sending the message to be transmitted according to the following steps:
a.i is 1, wherein i is the number of times of sending the current transmission data packet, and the value of i is 1,2,3 … …, N-M + 1;
when i is 1, it indicates that the transmission packet is currently transmitted for the 1 st time. Because the message to be transmitted has N data packets, the Nth data packet can be transmitted only by transmitting the data packets for N-M +1 times in total.
B. Placing the initial position of a transmission data window at a data packet with the number i; selecting an ith transmission data packet to be sent according to the length of a transmission data window, wherein the ith transmission data packet to be sent comprises M data packets numbered from i to i + M-1; transmitting the transmission data packet to be transmitted for the ith time;
as shown in fig. 3, when i is 1, the start position of the transmission data window is placed at the packet numbered 1. For example, if M is 3, the transmission packet to be transmitted 1 st time includes packets numbered 1,2, and 3. When i is 2, the start position of the transmission data window is placed at the data packet numbered 2, and the transmission data packet to be sent for the 2 nd time includes the data packets numbered 2,3, and 4. When i is 3, the start position of the transmission data window is placed at the data packet numbered 3, and the transmission data packets to be transmitted for the 2 nd time include the data packets numbered 3, 4, and 5. It can be seen that when i is 3, the packet numbered 3 has been transmitted 3 times until i is N-M +1, i.e., the packets numbered from M to N-M +1 have been repeatedly transmitted M times. Therefore, by means of iterative sending of the data packets, when a certain data packet generates transmission errors or packet loss in the transmission process, the data packet can be repeatedly sent for M-1 times, so that the packet loss of the data packet can be avoided to the greatest extent, the data packet does not need to be retransmitted, and the probability of retransmitting the data packet is reduced. In this embodiment, the receiving end may not return an ACK response in the transmission process, and the sending end does not need to wait for the ACK response returned by the receiving end, so that interaction between the sending end and the receiving end can be reduced, the efficiency of data transmission is improved, and the risk of packet loss possibly caused by no interaction feedback can be reduced.
C. Judging whether i +1 is less than or equal to N-M +1, if so, changing i to i +1, and returning to the step B; if not, the message to be transmitted is sent completely.
In this embodiment, N-M +1 transmission packets are transmitted in total from i-1 to i-N-M +1, the transmission data window floats back once every time a transmission packet is transmitted, and in the N-M +1 transmission packet, a packet numbered N-M +1 has been transmitted M times. And if the data packet with the number of N is contained in the (N-M +1) th transmission data packet, the message to be transmitted is considered to be sent completely.
In order to ensure the integrity and security of the data packet, in this embodiment, the transmission data packet may further carry a transmission packet check value, so that the receiving end performs integrity and security check on the received data packet according to the transmission packet check value. As another optional implementation manner in this embodiment, the transmission data packet to be sent for the ith time further includes: a transmission packet check value and the number of each data packet of a transmission data packet received at the kth time, wherein k is a positive integer; before sending the transmission data packet to be sent for the ith time in step B of step S105, the method provided in this embodiment further includes: and carrying out verification calculation on the data of the M data packets of the transmission data packet to be sent for the ith time and the data of each data packet of the transmission data packet received for the kth time to obtain a transmission packet verification value.
In this embodiment, the sending end may also receive a transmission data packet sent by a receiving end (an opposite end of the sending end), for example, the transmission data packet received the kth time is sent by the receiving end. Therefore, as an optional manner, the sending end may calculate a check value (i.e., a transmission packet check value) based on data of each data packet of a transmission data packet received by the sending end and data of each data packet of a transmission data packet to be sent, and after receiving the transmission data packet sent by the sending end, the receiving end may query the transmission data packet sent by the receiving end at a certain time according to the number of each data packet of the transmission data packet received by the sending end at the kth time (also the transmission data packet that the receiving end has sent once), and then the receiving end calculates a transmission packet comparison check value by using the data of the received transmission data packet and data of each data packet of the transmission data packet sent by the receiving end (i.e., the transmission data packet received by the sending end at the kth time), and compares the transmission packet comparison check value with the received transmission packet check value. In this embodiment, the sending end may use the received data of the transmission data packet to participate in calculating the check value, so as to increase the stability and accuracy of the check. For example, if the transmission data packet received by the transmitting end for the kth time is hijacked and tampered by the third party, the check value of the transmission packet calculated by the transmitting end is different from the comparison check value of the transmission packet calculated by the receiving end after receiving the transmission data packet sent by the transmitting end, and the check cannot pass, so that the receiving end can know the risk of packet loss, packet error or hijacked and tampered by the third party, and further take corresponding protective measures. Similarly, if the transmission data packet sent by the sending end this time is hijacked or tampered by a third party, the receiving end also checks that the transmission data packet cannot pass. Therefore, the sending end can increase the stability and accuracy of the verification by using the received data of the transmission data packet to participate in the calculation of the verification value, so that the integrity and the safety of the data packet can be more stably ensured. Likewise, the algorithm for calculating the check value of the transport packet is not limited to this embodiment, and for example, a parity check algorithm or a CRC algorithm, etc. may be used.
In addition, in this embodiment, although the probability of retransmission can be greatly reduced by transmitting the data packet in an iterative manner, there is still a case of packet loss or packet error, for this reason, after the transmission data packet to be transmitted for the ith time is transmitted, the method provided in this embodiment further includes: a sending end receives a retransmission request sent by an opposite end, wherein the retransmission request at least comprises the number n of a data packet to be retransmitted, and n is less than or equal to i; the method comprises the steps that a sending end places the initial position of a transmission data window at a data packet with the number of n, selects a transmission data packet to be retransmitted according to the length of the transmission data window, the transmission data packet to be retransmitted comprises M data packets with the number of n to n + M-1, and sends the transmission data packet to be retransmitted. Here, the manner in which the transmitting end transmits the data packet to be retransmitted is similar to that of step B in step S105, and reference may be made to the description of step B in step S105.
In this embodiment, as described above, the message to be transmitted may be a TCP/IP protocol message or a UDP message. When the message to be transmitted is a UDP message, taking transmission of the 1 st UDP transmission data packet as an example, the format of the UDP transmission data packet is shown in fig. 4, where a data portion of one UDP transmission data packet includes M data packets (see fig. 2 for data packet format), and taking M ═ 3 as an example, the M data blocks are sequentially connected together according to sequence numbers to form a data portion in the UDP transmission data packet. In addition, a UDP transport packet includes a UDP header and a UDP dummy header, wherein the UDP header occupies 8 bytes, which are a source port, a destination port, a length and a checksum, each of which occupies 2 bytes, and the UDP dummy header occupies 12 bytes. As an optional implementation manner, before sending the transmission data packet to be sent for the ith time, the method provided in this embodiment further includes: and calculating to obtain a checksum according to the UDP pseudo header, the UDP header and the data of the M data packets of the transmission data packet to be sent for the ith time, wherein the checksum can further verify the integrity and the safety of the UDP transmission data packet, and the stability and the accuracy of a verification result are improved.
In the data transmission method provided by this embodiment, the data packets are numbered and the data packets are iteratively transmitted according to the numbers, and when a transmission error or packet loss occurs in a transmission process of a certain data packet, the data packet can be repeatedly transmitted M-1 times, so that the packet loss of the data packet can be avoided to the greatest extent, and the probability of retransmission is reduced. In addition, the receiving end does not need to return an ACK response in the transmission process, and the sending end does not need to wait for the ACK response returned by the receiving end, so that the interaction between the sending end and the receiving end can be reduced, the efficiency of data transmission is improved, and the risk of packet loss possibly caused by the fact that interactive feedback is not needed can be reduced. And the integrity and the safety of the data packet can be ensured through the transmission of the plurality of check values mentioned above.
Example 2
The embodiment provides a data message receiving method. The data packet receiving method corresponds to the data transmission method provided in embodiment 1. As shown in fig. 5, the data message receiving method includes the following steps (S201-S205):
s201, presetting S cache units, and numbering the S cache units in sequence, wherein one cache unit is used for storing one data packet;
in this embodiment, in order to store N data packets of the packet to be transmitted in embodiment 1, S cache units are preset at the receiving end, where S is a positive integer and should be greater than or equal to N. The receiving end numbers S cache units 1,2 and … … S in advance, the numbers of the first N cache units in the S cache units correspond to the numbers of the N data packets one by one, one cache unit is used for storing one data packet, and the data packet can only be stored in the cache unit corresponding to the number of the data packet. Therefore, the receiving end can only store the data packet corresponding to the serial number of the cache unit which does not store the data packet, and the data packet which is repeatedly received for many times can be discarded, so that the working efficiency of the receiving end is improved.
S202, receiving transmission data packets, wherein the transmission data packets comprise Q data packets, the packet head of each data packet at least comprises the serial number of the data packet, Q is a positive integer, and Q is not more than S;
the format of the transmission data packet received by the receiving end is the same as the format of the transmission data packet sent by the sending end in embodiment 1 and the format of each data packet, which may be specifically referred to the description in embodiment 1. According to the method of sending the packet to be transmitted in step S104 in embodiment 1, the receiving end also receives multiple (e.g., N-M +1) transmission data packets, where each transmission data packet includes Q data packets. For each data packet, the data packet is received repeatedly for multiple times (for example, M times), and since the header of each data packet includes the number of the data packet, it can be identified whether the data packet is received repeatedly according to the number, and a corresponding cache unit can also be found according to the number, so as to facilitate the subsequent step of whether the data packet is stored in the cache unit.
S203, calculating a data packet check comparison value of each data packet in one of the following modes: carrying out check calculation on the serial number of the data packet and the data of the data packet to obtain a data packet check comparison value; or, carrying out check calculation on the data of the data packet to obtain a data packet check comparison value;
corresponding to the way of calculating the check value by the sending end, the receiving end also calculates the check comparison value in the same way as the sending end, for example, the sending end performs check calculation on the number and data of the data packet to obtain the check value of the data packet, and then the receiving end also performs check calculation on the number and data of the data packet to obtain the check comparison value of the data packet. Meanwhile, the same algorithm as that of the sending end is adopted to carry out check calculation on the data packets to obtain the data packet check comparison value of each data packet, for example, the sending end adopts the parity check algorithm to calculate, and then the receiving end also adopts the parity check algorithm to calculate. Specifically, the description in embodiment 1 may be referred to.
In this embodiment, after receiving a data packet in a transmission data packet, a receiving end may check the data packet by using an algorithm corresponding to the sending end, so as to ensure integrity and security of the received data packet (i.e., ensure that the received data packet is not tampered with).
S204, comparing the data packet check value of each data packet with the data packet check comparison value, and if the data packet check value of each data packet is consistent with the data packet check comparison value, executing the step S205;
if the comparison is consistent, the verification is passed, so that the integrity and the safety of the received data packet are ensured.
S205, sequentially judging whether the cache units corresponding to the numbers of the Q data packets store the data packets, storing the data packets corresponding to the numbers in the cache units which do not store the data packets, and discarding the data packets corresponding to the numbers of the cache units which store the data packets.
The numbers of Q data packets in the transmission data packets are sequentially numbered, such as 1,2,3, 4, and 5, and whether the corresponding buffer units (the numbers are also 1,2,3, 4, and 5) have stored data packets may be sequentially queried according to the numbers. The sending end sends the data packet in an iterative mode, so that the receiving end of the same data packet can receive the data packet repeatedly, if the data packet is stored in the cache unit, the data packet is discarded if the data packet is received, and if the data packet is not stored in the cache unit, the data packet is stored if the data packet is possibly received for the first time or the packet loss occurs. In addition, in this embodiment, the receiving end does not need to return an ACK response to the sending end after receiving the data packet, which reduces interaction between the sending end and the receiving end and can improve data transmission efficiency.
According to the method of sending the message to be transmitted in step S105 in embodiment 1, the receiving end also receives the multiple (e.g., N-M +1) transmission data packets, so as to receive the complete message to be transmitted. In the above, only how to operate after receiving one transmission data packet is described, but for any transmission data packet received by the receiving end, the receiving and storing modes can operate in the manners described in steps S202 to S205.
In this embodiment, the transmission data packet received by the receiving end also carries a transmission packet check value, and the transmission packet check value is used for checking and comparing to ensure the integrity and security of the data packet. As another optional implementation manner in this embodiment, the transmitting the data packet further includes: the method comprises the steps that a transmission packet check value and the number of each data packet of a transmission data packet sent at the kth time are obtained, wherein k is a positive integer, k is less than S, and S is the number of cache units; after receiving the transmission data packet in step S202, before storing the data packet corresponding to the number thereof in the cache unit that does not store the data packet in step S205, the method provided in this embodiment further includes: acquiring each data packet of the transmission data packet sent at the kth time according to the number of each data packet of the transmission data packet sent at the kth time; carrying out verification calculation on the data of the Q data packets and the data of each data packet of the transmission data packet sent at the kth time to obtain a transmission packet verification comparison value of the transmission data packet; and comparing the transmission packet check value with the transmission packet check comparison value, if the transmission packet check value is consistent with the transmission packet check comparison value, the check is passed, and the step of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet is executed.
Similarly, the receiving end also calculates the check comparison value in the same manner and algorithm as the transmitting end, and the specific manner and algorithm for calculating the transmission packet check comparison value may refer to the description of the specific manner for calculating the transmission packet check value in embodiment 1.
The transmission data packet sent for the kth time can be a transmission data packet sent by the receiving end last time or a transmission data packet sent for the previous times, because the sending end calculates a transmission packet check value based on the data packet of the transmission data packet sent for the kth time, and the receiving end also calculates a transmission packet check comparison value based on the data packet of the transmission data packet sent for the kth time, the check will pass, but if the data or the number of each data packet of the transmission data packet sent for the kth time is hijacked and tampered by a third party, the check of the receiving end cannot pass, so that the receiving end can know the risk of packet loss, packet error or hijacked and tampered by the third party, and further take corresponding protection measures. Therefore, the receiving end can utilize the data of the transmitted data packet sent by the receiving end to participate in calculating the check comparison value, so that the stability and the accuracy of the check can be improved, and the integrity and the safety of the data packet can be ensured more stably.
In addition, the step of storing the data packet is executed after both checks (the double check of the verification value of the data packet and the verification of the verification value of the transmission packet) pass, and the subsequent steps are not executed as long as one check does not pass, so that the safety of data transmission can be ensured, and the integrity and the safety of the data packet stored in the cache unit are further ensured.
In addition, in this embodiment, although the probability of retransmission can be greatly reduced by transmitting the data packet in an iterative manner, there is still a case of packet loss or packet error, for this reason, in this embodiment, after the transmission data packet is received in step S202, while steps S203 to S205 are executed, it may also be identified whether there is a data packet that needs to be retransmitted, and a retransmission request is initiated to the transmitting end. Specifically, after receiving the transmission data packet, the method provided in this embodiment further includes: judging whether n is satisfied1=n2+1, wherein n1Is the smallest number, n, of the Q packet numbers2The number is the minimum number in the numbers of the cache units which do not store the data packets; if yes, sending a retransmission request to the sending end, wherein the retransmission request comprises the number n of the data packet requesting retransmission2. For example, the buffer unit with number 2 (the smallest number) has not stored a packet, but Q packets of the received transmission packets have numbers 3, 4, and 5. The starting position of the data transmission window of the sending end is already floated to the position of the data packet with the number 3, and according to the backward floating mode, the next sending transmission data packet starts to be sent from the data packet with the number 4, and the data packet with the number 2 cannot be sent any more. And thisIf the buffer unit numbered 2 still does not receive the packet with the corresponding number, the receiving end recognizes this (n)1=n2+1), then request the transmitting end to transmit the last transmitted transmission data packet (number n)2) I.e. the transmission data packet determined by the transmission data window starting from number 2, therefore, the receiving end carries the smallest number of the numbers of the buffer units which do not store the data packet in the retransmission request to indicate which transmission data packet is retransmitted by the transmitting end. The method for identifying whether retransmission is needed can reduce the number of retransmission, that is, only request retransmission of the data packet with the smallest number once, and can immediately initiate retransmission when the data transmission window of the sending end floats to the next of the smallest number, thereby ensuring the integrity of data in time.
Of course, the above-mentioned retransmission initiation manner provided in this embodiment is only an optimal manner, and the receiving end may not determine whether n is satisfied or not1=n2+1. For example, as another alternative, it may be determined whether there is a number m of a cache unitiLess than n1,miIs less than n1Number of each buffer unit of (1), miThe value is positive integer, and then the retransmission request contains the number m of each cache uniti(for example, m1 ═ 1, m2 ═ 3, … …, and m100 ═ 200). The receiving end may perform the determination after receiving each transmission data packet, or perform the determination after receiving a plurality of transmission data packets, and request to retransmit the data packets corresponding to the numbers.
In this embodiment, as described in embodiment 1, the message to be transmitted may be a TCP/IP protocol message or a UDP message. When the packet to be transmitted is a UDP packet, a format of a UDP transport packet is shown in fig. 4, where a data portion of the UDP transport packet includes Q packets (see fig. 2 for packet format), for example, Q is 3, and Q data blocks are sequentially connected together according to sequence numbers to form the data portion in the UDP transport packet. In addition, the transmission data packet further includes a UDP pseudo header and a UDP header; the UDP header includes: and (6) checking the sum. As an optional implementation manner, after receiving the transmission data packet, before storing the data packet corresponding to the number of the transmission data packet in the cache unit that does not store the data packet, the method provided in this embodiment further includes: calculating to obtain a comparison check sum of the transmission data packets according to the UDP pseudo-header, the UDP header and the data of the Q data packets; and comparing the comparison check sum and the check sum of the transmitted data packets, if the comparison check sum and the check sum are consistent, passing the check, and executing the step of storing the data packets corresponding to the serial numbers in the cache unit which does not store the data packets. Through the verification of the checksum, the integrity and the safety of the UDP transmission data packet can be further verified, and the stability and the accuracy of a verification result are improved.
In addition, as an optional implementation manner, a buffer area for storing buffer data may be further provided in this embodiment, after the transmission data packet is stored in the buffer unit, corresponding processing is performed, and then the transmission data packet is transferred to the buffer area, where the data packet in the buffer area may be output or called (e.g., playing of an audio video stream, etc.). As an optional implementation manner, the size of the buffer area may be calculated according to the network delay and the processing time of the buffer unit for processing a data packet, for example, the receiving end sends a network delay detection packet to the sending end, and calculates the network delay T1 according to the response time of a response packet returned by the sending end; the time T for processing a data packet is multiplied by the number S of the buffer units to obtain a buffer processing time delay T2; the network delay T1 and the buffer processing delay T2 are summed to obtain the delay time T3, and the space size of the buffer is calculated by dividing the delay time T3 by the time T for processing a transmission data packet. This is only a specific example given in this embodiment, and this embodiment does not limit the way of the size of the technology buffer, because there may be different calculation ways according to the type of the transmission data.
In the data packet receiving method provided in this embodiment, by correspondingly numbering the data packets and the cache units, the same data packet may be repeatedly received for multiple times, and the data packets are stored in the corresponding cache units according to the numbers. In addition, the receiving end does not need to return an ACK response in the transmission process, and the sending end does not need to wait for the ACK response returned by the receiving end, so that the interaction between the sending end and the receiving end can be reduced, the efficiency of data transmission is improved, and the risk of packet loss possibly caused by the fact that interactive feedback is not needed can be reduced. And the integrity and the safety of the data packet can be ensured through the verification of the plurality of verification values mentioned above.
Example 3
The embodiment also provides a data transmission system. As shown in fig. 6, the system includes a data transmitting device and a data packet receiving device, where the data transmitting device may be applied to the data transmitting method in embodiment 1, and the specific structure is as shown in fig. 7, and the data packet receiving device may be applied to the data packet receiving method in embodiment 2, and the specific structure is as shown in fig. 8. Specific functions of the data transmission device and the reception device can be referred to the specific description in embodiments 1 and 2. This embodiment is described only briefly.
As shown in fig. 7, the data transmission device includes:
the device comprises an acquisition module, a transmission module and a transmission module, wherein the acquisition module is used for acquiring a message to be transmitted, and the message to be transmitted consists of N data packets;
the data packet processing module is used for numbering N data packets in sequence, and carrying out check calculation on the numbers of the data packets and the data of the data packets to obtain a data packet check value of each data packet; or, carrying out check calculation on the data of each data packet to obtain a data packet check value of each data packet, and numbering the N data packets in sequence; the header of each data packet at least comprises a number distributed to the data packet and a data packet check value calculated for the data packet;
a transmission data window configuration module, configured to determine the length of a transmission data window, where the length of the transmission data window is used to determine the number M of data packets included in one transmission data packet, M, N is a positive integer, and M is less than or equal to N;
the sending module is used for sending the message to be transmitted according to the following steps: a.i is 1, wherein i is the number of times of sending the current transmission data packet, and the value of i is 1,2,3 … …, N-M + 1; B. placing the initial position of a transmission data window at a data packet with the number i; selecting an ith transmission data packet to be sent according to the length of a transmission data window, wherein the ith transmission data packet to be sent comprises M data packets numbered from i to i + M-1; transmitting the transmission data packet to be transmitted for the ith time; C. judging whether i +1 is less than or equal to N-M +1, if so, changing i to i +1, and returning to the step B; if not, the message to be transmitted is sent completely.
As an optional manner, the transmission data packet to be sent for the ith time further includes: a transmission packet check value and the number of each data packet of a transmission data packet received at the kth time, wherein k is a positive integer;
and the data packet processing module is further configured to perform check calculation on data of each data packet of the ith transmission data packet to be sent and data of each data packet of the kth received transmission data packet to obtain a transmission packet check value before the transmission module sends the ith transmission data packet to be sent.
As an optional mode, the data transmission apparatus further includes: a receiving module, wherein: a receiving module, configured to receive a retransmission request, where the retransmission request at least includes a number n of a data packet to be retransmitted, where n is greater than or equal to i; the sending module is also used for placing the initial position of the transmission data window at the data packet with the number of n; and selecting a transmission data packet to be retransmitted according to the length of the transmission data window, wherein the transmission data packet to be retransmitted comprises M data packets numbered from n to n + M-1, and sending the transmission data packet to be retransmitted.
As an optional mode, the data transmission apparatus further includes: and the message processing module is used for dividing the message to be transmitted into N data packets according to a preset strategy.
As an optional manner, the transmission data packet to be sent for the ith time includes a UDP pseudo header and a UDP header; the UDP header includes: checking the sum; and the data packet processing module is further used for calculating and obtaining a checksum according to the UDP pseudo header, the UDP header and the data of the M data packets of the transmission data packet to be sent for the ith time.
As shown in fig. 8, the data packet receiving apparatus includes: s buffer memory unit, buffer memory unit processing module, receiving module, data packet processing module and control module, wherein:
the processing module is used for numbering the S cache units in sequence, wherein one cache unit is used for storing one data packet;
the receiving module is used for receiving transmission data packets, wherein the transmission data packets comprise Q data packets, the packet head of each data packet at least comprises the serial number of the data packet, S, Q is a positive integer, and Q is less than or equal to S;
the data packet processing module is used for calculating the data packet check comparison value of each data packet in one of the following modes: carrying out check calculation on the serial number of the data packet and the data of the data packet to obtain a data packet check comparison value; or, carrying out check calculation on the data of the data packet to obtain a data packet check comparison value;
and the control module is used for comparing the data packet check value and the data packet check comparison value of each data packet, if the data packet check value and the data packet check comparison value of each data packet are consistent, sequentially judging whether the data packets are stored in the cache units corresponding to the numbers of the Q data packets, storing the data packets corresponding to the numbers in the cache units which do not store the data packets, and discarding the data packets corresponding to the numbers of the cache units which store the data packets.
As an optional manner in this embodiment, the transmitting the data packet further includes: the transmission packet check value and the number of each data packet of the transmission data packet sent at the kth time;
the data packet processing module is further used for acquiring each data packet of the transmission data packet sent for the kth time according to the number of each data packet of the transmission data packet sent for the kth time; carrying out verification calculation on the data of the Q data packets and the data of each data packet of the transmission data packet sent at the kth time to obtain a transmission packet verification comparison value of the transmission data packet;
and the control module is also used for comparing the transmission packet check value with the transmission packet check comparison value, if the transmission packet check value is consistent with the transmission packet check comparison value, the check is passed, and the operation of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet is executed.
As an optional mode in this embodiment, the data sending apparatus further includes: a sending module; wherein: a control module for judging whether n is satisfied1=n2+1, wherein n1Is the smallest number, n, of the Q packet numbers2The number is the minimum number in the numbers of the cache units which do not store the data packets; if yes, controlling the sending module to send a retransmission request to the sending end; a sending module, configured to send a retransmission request to a sending end, where the retransmission request includes a number n of a data packet requested to be retransmitted2
As an optional manner in this embodiment, the transmission data packet further includes a UDP dummy header and a UDP header; the UDP header includes: checking the sum; the data packet processing module is further configured to calculate a comparison checksum of the transmission data packet according to the UDP pseudo header, the UDP header, and the Q data packets; and the control module is also used for comparing the comparison check sum and the check sum of the transmission data packets, if the comparison check sum and the check sum are consistent, the check is passed, and the step of storing the data packets corresponding to the serial numbers of the data packets in the cache unit which does not store the data packets is executed.
Any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and alternate implementations are included within the scope of the preferred embodiment of the present invention in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
It should be understood that portions of the present invention may be implemented in hardware, software, firmware, or a combination thereof. In the above embodiments, the various steps or methods may be implemented in software or firmware stored in memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, any one or combination of the following techniques, which are known in the art, may be used: a discrete logic circuit having a logic gate circuit for implementing a logic function on a data signal, an application specific integrated circuit having an appropriate combinational logic gate circuit, a Programmable Gate Array (PGA), a Field Programmable Gate Array (FPGA), or the like.
It will be understood by those skilled in the art that all or part of the steps carried by the method for implementing the above embodiments may be implemented by hardware related to instructions of a program, which may be stored in a computer readable storage medium, and when the program is executed, the program includes one or a combination of the steps of the method embodiments.
In addition, functional units in the embodiments of the present invention may be integrated into one processing module, or each unit may exist alone physically, or two or more units are integrated into one module. The integrated module can be realized in a hardware mode, and can also be realized in a software functional module mode. The integrated module, if implemented in the form of a software functional module and sold or used as a stand-alone product, may also be stored in a computer readable storage medium.
The storage medium mentioned above may be a read-only memory, a magnetic or optical disk, etc.
In the description herein, references to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., mean that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above do not necessarily refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples.
Although embodiments of the present invention have been shown and described above, it is understood that the above embodiments are exemplary and should not be construed as limiting the present invention, and that variations, modifications, substitutions and alterations can be made in the above embodiments by those of ordinary skill in the art without departing from the principle and spirit of the present invention. The scope of the invention is defined by the appended claims and equivalents thereof.

Claims (6)

1. A method for receiving a data message, comprising:
presetting S cache units, and numbering the S cache units in sequence, wherein one cache unit is used for storing one data packet;
receiving transmission data packets, wherein the transmission data packets comprise Q data packets, the packet head of each data packet at least comprises the serial number of the data packet and a data packet check value, S, Q is a positive integer, and Q is less than or equal to S;
calculating the packet check comparison value of each data packet by one of the following methods: carrying out check calculation on the serial number of the data packet and the data of the data packet to obtain a check comparison value of the data packet; or, carrying out check calculation on the data of the data packet to obtain a check comparison value of the data packet;
comparing the data packet check value of each data packet with the data packet check comparison value, if the data packet check value of each data packet is consistent with the data packet check comparison value, sequentially judging whether the data packets are stored in the cache units corresponding to the numbers of the Q data packets, storing the data packets corresponding to the numbers of the cache units in which the data packets are not stored, and discarding the data packets corresponding to the numbers of the cache units in which the data packets are stored;
the transmission data packet further comprises: the transmission packet check value and the number of each data packet of the transmission data packet sent at the kth time;
wherein:
after receiving the transmission data packet, before storing the data packet corresponding to the number thereof in the buffer unit which does not store the data packet, the method further comprises:
acquiring each data packet of the transmission data packet sent at the kth time according to the number of each data packet of the transmission data packet sent at the kth time;
carrying out verification calculation on the data of the Q data packets and the data of each data packet of the transmission data packet sent at the kth time to obtain a transmission packet verification comparison value of the transmission data packet;
and comparing the transmission packet check value with the transmission packet check comparison value, if the transmission packet check value is consistent with the transmission packet check comparison value, the check is passed, and the step of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet is executed.
2. The method of claim 1, wherein: after receiving the transmission data packet, the method further comprises:
judging whether n is satisfied1=n2+1, wherein n1Is the smallest number, n, of the numbers of the Q data packets2The number is the minimum number in the numbers of the cache units which do not store the data packets;
if yes, sending a retransmission request to a sending end, wherein the retransmission request comprises the number n of the data packet requesting retransmission2
3. The method of claim 1 or 2, wherein:
the transmission data packet further comprises a UDP pseudo-header and a UDP header; the UDP header includes: checking the sum;
after receiving the transmission data packet, before storing the data packet corresponding to the number thereof in the buffer unit which does not store the data packet, the method further comprises: calculating to obtain a comparison check sum of the transmission data packet according to the UDP pseudo header, the UDP header and the Q data packets;
and comparing the checksum of the transmission data packet with the comparison checksum, if the checksum is consistent with the comparison checksum, passing the verification, and executing the step of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet.
4. A data message receiving apparatus, comprising: s buffer memory unit, buffer memory unit processing module, receiving module, data packet processing module and control module, wherein:
the cache unit processing module is used for numbering the S cache units in sequence, wherein one cache unit is used for storing one data packet;
the receiving module is used for receiving transmission data packets, wherein the transmission data packets comprise Q data packets, the packet header of each data packet at least comprises the serial number of the data packet, S, Q is a positive integer, and Q is less than or equal to S;
the data packet processing module is used for calculating the data packet check comparison value of each data packet in one of the following modes: carrying out check calculation on the serial number of the data packet and the data of the data packet to obtain a check comparison value of the data packet; or, carrying out check calculation on the data of the data packet to obtain a check comparison value of the data packet;
the control module is used for comparing the data packet check value of each data packet with the data packet check comparison value, if the data packet check value of each data packet is consistent with the data packet check comparison value, sequentially judging whether the data packets are stored in the cache units corresponding to the numbers of the Q data packets, storing the data packets corresponding to the numbers of the data packets in the cache units which do not store the data packets, and discarding the data packets corresponding to the numbers of the cache units which store the data packets;
wherein:
the transmission data packet further comprises: the transmission packet check value and the number of each data packet of the transmission data packet sent at the kth time;
the data packet processing module is further configured to obtain each data packet of the transmission data packet sent for the kth time according to the number of each data packet of the transmission data packet sent for the kth time; carrying out verification calculation on the data of the Q data packets and the data of each data packet of the transmission data packet sent at the kth time to obtain a transmission packet verification comparison value of the transmission data packet;
the control module is further configured to compare the transmission packet check value with the transmission packet check comparison value, and if the transmission packet check comparison value is consistent with the transmission packet check comparison value, the check is passed, and the operation of storing the data packet corresponding to the serial number in the cache unit which does not store the data packet is executed.
5. The apparatus of claim 4, wherein: still include the sending module, wherein:
the control module is also used for judging whether n is satisfied1=n2+1, if yes, controlling the sending module to send a retransmission request to the sending end; wherein n is1Is the smallest number, n, of the numbers of the Q data packets2The number is the minimum number in the numbers of the cache units which do not store the data packets;
the sending module is configured to send the retransmission request to the sending end, where the retransmission request includes a number n of a data packet requested to be retransmitted2
6. The apparatus of claim 4 or 5, wherein:
the transmission data packet further comprises a UDP pseudo-header and a UDP header; the UDP header includes: checking the sum;
the data packet processing module is further configured to calculate a comparison checksum of the transmission data packet according to the UDP pseudo header, the UDP header, and the Q data packets;
the control module is further configured to compare the comparison checksum and the checksum of the transmission data packet, and if the comparison checksum and the checksum are consistent, the check is passed, and the step of storing the data packet corresponding to the serial number in the cache unit where the data packet is not stored is executed.
CN201810246182.9A 2018-03-23 2018-03-23 Data message receiving method and device Active CN110299971B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810246182.9A CN110299971B (en) 2018-03-23 2018-03-23 Data message receiving method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810246182.9A CN110299971B (en) 2018-03-23 2018-03-23 Data message receiving method and device

Publications (2)

Publication Number Publication Date
CN110299971A CN110299971A (en) 2019-10-01
CN110299971B true CN110299971B (en) 2022-04-08

Family

ID=68025956

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810246182.9A Active CN110299971B (en) 2018-03-23 2018-03-23 Data message receiving method and device

Country Status (1)

Country Link
CN (1) CN110299971B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110912766B (en) * 2019-10-18 2021-04-20 国家计算机网络与信息安全管理中心 Communication network multi-plane data consistency checking method
CN111277602B (en) * 2020-01-23 2023-07-11 奇安信科技集团股份有限公司 Method, device, electronic device, and storage medium for identifying and processing network data packets

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101145893A (en) * 2007-10-08 2008-03-19 华为技术有限公司 Receiving method, device and billing gateway for CDR data frame
CN102185676A (en) * 2004-01-16 2011-09-14 Zih公司 Method and system for calculating and verifying the integrity of data in a data transmission system
CN103957169A (en) * 2014-05-14 2014-07-30 上海复兰信息科技有限公司 Reliable UDP achievement method based on reserve request
CN106453233A (en) * 2016-08-10 2017-02-22 深圳市中兴物联科技股份有限公司 Data transmission method and apparatus based on UDP

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102185676A (en) * 2004-01-16 2011-09-14 Zih公司 Method and system for calculating and verifying the integrity of data in a data transmission system
CN101145893A (en) * 2007-10-08 2008-03-19 华为技术有限公司 Receiving method, device and billing gateway for CDR data frame
CN103957169A (en) * 2014-05-14 2014-07-30 上海复兰信息科技有限公司 Reliable UDP achievement method based on reserve request
CN106453233A (en) * 2016-08-10 2017-02-22 深圳市中兴物联科技股份有限公司 Data transmission method and apparatus based on UDP

Also Published As

Publication number Publication date
CN110299971A (en) 2019-10-01

Similar Documents

Publication Publication Date Title
CN101621471B (en) System for transmitting and receiving packets
KR100458878B1 (en) Method for transmitting and receiving a variable size packet based on foward error correction coding
US20080195912A1 (en) Method of communicatoin
US9007905B2 (en) System to improve an Ethernet network
CN110299970B (en) Data message sending method and device
JP6148459B2 (en) How to transport data from a source node to a destination node
JP2003503894A (en) System and method for implementing a hybrid automatic repeat request using a parity check combination
KR101118194B1 (en) Method for lost packet reconstruction and device for carrying out said method
US20140108878A1 (en) Method, Apparatus, and System for Retransmitting Data Packet in Quick Path Interconnect System
CN110299971B (en) Data message receiving method and device
CN110299973B (en) Receiving method and device for data rolling transmission
CN110299969B (en) Method and device for transmitting data in rolling mode
JP6064593B2 (en) Program, information processing apparatus, and communication method
WO2022042543A1 (en) Retransmission method for ethernet error frame and related apparatus
WO2015006908A1 (en) Processing method, device and system for idle block (idle) in burst data block
JP3929452B2 (en) Efficient data transmission / reception method using transport layer in mobile ad hoc network and network device using the method
CN110299974A (en) A kind of data receiver method and device
CN110299972A (en) A kind of data transmission method for uplink and device
CN114285528A (en) Method for transmitting message and communication device
CN117157921A (en) Data transmission method, device, equipment and storage medium based on low-power consumption Bluetooth
CN114500672A (en) Data transmission method and system
CN106100797B (en) A kind of method for transmitting deep space file based on the asynchronous acceleration re-transmission policy of LTP
ES2349189T3 (en) SYSTEM AND METHOD FOR IMPROVED DATA TRANSFER IN COMMUNICATION NETWORKS BY PACKAGE SWITCHING.
EP3487101B1 (en) Method, receiver and network apparatus for delivering payloads through an interface
US20090164679A1 (en) Data transmission method and corresponding device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant