CN107483148B - Error processing method and device - Google Patents

Error processing method and device Download PDF

Info

Publication number
CN107483148B
CN107483148B CN201710632119.4A CN201710632119A CN107483148B CN 107483148 B CN107483148 B CN 107483148B CN 201710632119 A CN201710632119 A CN 201710632119A CN 107483148 B CN107483148 B CN 107483148B
Authority
CN
China
Prior art keywords
sub
terminal
data packet
packet
received
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
CN201710632119.4A
Other languages
Chinese (zh)
Other versions
CN107483148A (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.)
Beijing North Source Software Co ltd
Original Assignee
Beijing North Source Software Co ltd
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 Beijing North Source Software Co ltd filed Critical Beijing North Source Software Co ltd
Priority to CN201710632119.4A priority Critical patent/CN107483148B/en
Publication of CN107483148A publication Critical patent/CN107483148A/en
Application granted granted Critical
Publication of CN107483148B publication Critical patent/CN107483148B/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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/164Adaptation or special uses of UDP protocol

Abstract

The embodiment of the invention provides an error processing method and a device, wherein the method comprises the following steps: the first terminal splits data to be sent into a plurality of sub data packets; assembling a head data packet, writing the total packet number, the serial number and the CRC value of the sub data packet and the CRC value of the head data packet into the head data packet, and sending the head data packet to a second terminal, wherein the second terminal checks the correctness of the head data packet according to the CRC value of the head data packet; when the first terminal receives first feedback information sent by the second terminal within a first preset time, the plurality of sub-data packets are respectively sent to the second terminal, and the second terminal checks the correctness and the integrity of the received sub-data packets according to the total packet number, the serial numbers of the sub-data packets and the CRC value. The error processing scheme provided by the invention avoids the defect of unreliable data information in a UDP communication mode and improves the correctness and the integrity of data transmission by checking the correctness of the head data packet and checking the correctness and the integrity of the sub data packet.

Description

Error processing method and device
Technical Field
The present invention relates to the field of information security and communication technologies, and in particular, to an error processing method and apparatus.
Background
The UDP communication Protocol (User data Protocol) is a connectionless transport layer Protocol that provides transaction-oriented, simple and unreliable messaging services. UDP communication performs very well when handling small batches of data. However, as a connectionless communication method, it often results in unreliable data transmission. The integrity and correctness of the data cannot be confirmed in the data transmission. The prior art lacks an effective and reliable error control processing method for transmission data based on a UDP communication protocol to ensure the integrity and the correctness of the transmission data. Therefore, a problem to be solved is to realize an effective error control processing method for transmission data.
Disclosure of Invention
In view of the above, the present invention provides an error handling method and apparatus to solve the above problems.
The preferred embodiment of the present invention provides an error processing method, which is applied to a first terminal connected to a second terminal through UDP protocol communication, and the error processing method includes:
splitting data to be sent into a plurality of sub data packets, counting the total number of the sub data packets and obtaining the number and CRC value of each sub data packet;
assembling a header data packet, writing the total packet number, the serial number and the CRC value of each sub data packet and the CRC value of the header data packet into the header data packet, and sending the header data packet to the second terminal so that the second terminal can check the correctness of the header data packet according to the CRC value of the header data packet;
and detecting whether first feedback information which is sent by the second terminal and indicates that the head data packet is normally received is received or not within a first preset time, and if the first feedback information sent by the second terminal is received, respectively sending the plurality of sub data packets to the second terminal so that the second terminal can check the correctness and the integrity of the received sub data packets according to the total packet number, the serial numbers of the sub data packets and the CRC value.
Optionally, the method further comprises:
detecting whether second feedback information which is sent by the second terminal and indicates that the sub-data packet is normally received is received or not within second preset time;
if the second feedback information sent by the second terminal is not received, the sub-data packet is sent to the second terminal again;
and detecting whether the sending times of the sub-data packets reach preset times or not, and if so, judging that the sending of the sub-data packets fails.
Optionally, the method further comprises:
and when third feedback information which is sent by the second terminal and indicates that the received sub-data packet is wrong is received, the sub-data packet is sent to the second terminal again.
Optionally, the method further comprises:
and when receiving fourth feedback information which is sent by the second terminal and indicates that the sub-packets are missing, resending the missing sub-packets to the second terminal.
Another preferred embodiment of the present invention further provides an error handling method, which is applied to a second terminal connected to a first terminal through UDP protocol communication, where the first terminal stores a plurality of subpackets in advance, and the error handling method includes:
receiving a header data packet sent by the first terminal, wherein the header data includes a total packet number of the plurality of sub data packets, a number and a CRC value of each sub data packet, and a CRC value of the header data packet;
detecting whether the header data packet is correct or not according to the CRC value of the header data packet, if so, sending a response of normal reception of the header data packet to the first terminal so that the first terminal sends the plurality of sub data packets to the second terminal;
receiving the sub data packets sent by the first terminal, and detecting whether the received sub data packets are correct or not according to the serial numbers and CRC values of the sub data packets in the header data packet;
and detecting whether the received sub data packet is complete or not according to the total packet number in the head data packet.
Optionally, the step of detecting whether the received sub data packet is correct according to the number and the CRC value of each sub data packet in the header data packet includes:
and detecting whether the number of the received sub-data packet is consistent with the number of the set data packet to be received, if not, discarding the sub-data packet, if so, detecting whether the CRC value of the sub-data packet is consistent with the CRC value of the sub-data packet with the same number as the sub-data packet in the header data packet, and if so, judging that the sub-data packet is correct.
Optionally, the step of detecting whether the received subpacket is complete according to the total packet number in the header packet includes:
counting whether the number of the sub-data packets received within a third preset time reaches the total number of the sub-data packets, and if so, judging that the received sub-data packets are complete;
if the total number of packets is not reached, the method further comprises:
and finding the sub-data packets which are not normally received, and sending a request to the first terminal so that the first terminal sends the sub-data packets which are not normally received.
Optionally, the method further comprises:
counting whether the number of sub-data packets received within a fourth preset time reaches the total number of sub-data packets, wherein the fourth preset time is longer than the third preset time;
if the total number of the packets is not reached, the data receiving fails.
Another preferred embodiment of the present invention further provides an error processing apparatus, which is applied to a first terminal communicatively connected to a second terminal through a UDP protocol, and includes:
the splitting module is used for splitting the data to be sent into a plurality of sub data packets, counting the total number of the sub data packets and obtaining the serial number and the CRC value of each sub data packet;
the assembling module is used for assembling a head data packet, writing the total packet number, the serial number and the CRC value of each sub-data packet and the CRC value of the head data packet into the head data packet, and sending the head data packet to the second terminal so that the second terminal can check the correctness of the head data packet according to the CRC value of the head data packet;
the first detection module is used for detecting whether first feedback information which is sent by the second terminal and indicates that the header data packet is normally received is received within first preset time;
and the sending module is used for sending the plurality of sub-data packets to the second terminal respectively when first feedback information sent by the second terminal is received, so that the second terminal can check the correctness and the integrity of the received sub-data packets according to the total packet number, the serial numbers of the sub-data packets and the CRC value.
Another preferred embodiment of the present invention further provides an error processing apparatus, which is applied to a second terminal connected to a first terminal through UDP communication, where the first terminal stores a plurality of subpackets in advance, and the error processing apparatus includes:
a receiving module, configured to receive a header data packet sent by the first terminal, where the header data includes a total packet number of the multiple sub data packets, a number and a CRC value of each sub data packet, and a CRC value of the header data packet;
a header packet detection module, configured to detect whether the header packet is correct according to a CRC value of the header packet;
a response module, configured to send a response that the header data packet is normally received to the first terminal when the header data packet is correct, so that the first terminal sends the multiple sub data packets to the second terminal;
a second detection module, configured to receive the sub data packet sent by the first terminal, and detect whether the received sub data packet is correct according to the number and the CRC value of each sub data packet in the header data packet;
and the third detection module is used for detecting whether the received sub data packet is complete or not according to the total packet number in the head data packet.
According to the error processing method and device provided by the embodiment of the invention, the first terminal writes the related information of the sub-data packet into the header data packet and sends the related information to the second terminal, and the second terminal sends the confirmation information to the first terminal after detecting the correctness of the header data packet so that the first terminal sends the sub-data packet. And the second terminal checks the correctness and the integrity of the received sub-data packet according to the related information of the sub-data packet carried in the head data packet. The error processing scheme provided by the invention avoids the defect of unreliable data information in a UDP communication mode and improves the correctness and the integrity of data transmission by checking the correctness of the head data packet and checking the correctness and the integrity of the sub data packet.
In order to make the aforementioned and other objects, features and advantages of the present invention comprehensible, preferred embodiments accompanied with figures are described in detail below.
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 embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.
Fig. 1 is a schematic view of an application scenario of the error handling method according to the preferred embodiment of the present invention.
Fig. 2 is a schematic structural block diagram of a first terminal according to a preferred embodiment of the present invention.
Fig. 3 is a schematic structural block diagram of a second terminal according to a preferred embodiment of the present invention.
Fig. 4 is a flowchart of an error handling method applied to a first terminal according to a preferred embodiment of the present invention.
Fig. 5 is another flowchart of an error handling method applied to the first terminal according to a preferred embodiment of the present invention.
Fig. 6 is a flowchart of an error handling method applied to a second terminal according to a preferred embodiment of the present invention.
Fig. 7 is a flowchart of the substeps of step S305 in fig. 6.
Fig. 8 is a functional block diagram of a first error processing apparatus according to a preferred embodiment of the present invention.
Fig. 9 is a functional block diagram of a second error processing apparatus according to a preferred embodiment of the present invention.
Icon: 100-a first terminal; 110-a first error handling means; 111-split module; 112-assembling the module; 113-a first detection module; 114-a sending module; 120-a first processor; 130-a first memory; 200-a second terminal; 210-second error handling means; 211-a receiving module; 212-header packet detection module; 213-response module; 214-a second detection module; 215-a third detection module; 220-a second processor; 230-second memory.
Detailed Description
The technical solutions in the embodiments of the present invention will be 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 of the embodiments. The components of embodiments of the present invention generally described and illustrated in the figures herein may be arranged and designed in a wide variety of different configurations. Thus, the following detailed description of the embodiments of the present invention, presented in the figures, is not intended to limit the scope of the invention, as claimed, but is merely representative of selected embodiments of the invention. 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.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present invention, unless otherwise explicitly specified or limited, the term "connected" is to be broadly construed, and for example, may be fixedly connected, detachably connected, or integrally connected; 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.
Fig. 1 is a schematic view of an application scenario of an error handling method according to an embodiment of the present invention. The scenario includes a first terminal 100 and a second terminal 200. The first terminal 100 is in communication connection with the second terminal 200 through a network to perform data communication or interaction. In this embodiment, the first terminal 100 and the second terminal 200 may include a plurality of terminals (only one terminal is shown in the figure), and the plurality of first terminals 100 may be respectively connected to the plurality of second terminals 200 in a communication manner. In this embodiment, the first terminal 100 and the second terminal 200 perform data transmission via UDP communication protocol.
The first terminal 100 and the second terminal 200 may be, but are not limited to, a personal computer, a tablet computer, a smart phone, a mobile internet device, and the like. In this embodiment, the first terminal 100 may be a sender of data, and the second terminal 200 may be a receiver of data.
Referring to fig. 2, a schematic block diagram of the first terminal 100 according to an embodiment of the present invention is provided. In this embodiment, the first terminal 100 includes a first error handling apparatus 110, a first processor 120, and a first memory 130. The first memory 130 is electrically connected to the first processor 120 directly or indirectly, so as to implement data transmission or interaction. The first error handling means 110 comprises at least one software function module which may be stored in the form of software or firmware in the first memory 130 or solidified in the operating system of the first terminal 100. The first processor 120 is configured to execute an executable module stored in the first memory 130, such as a software functional module or a computer program included in the first error handling device 110.
Referring to fig. 3, a schematic structural block diagram of the second terminal 200 according to an embodiment of the present invention is shown. In this embodiment, the second terminal 200 includes a second error processing device 210, a second processor 220 and a second memory 230. The second memory 230 is directly or indirectly electrically connected to the second processor 220 to implement data transmission or interaction. The second error handling means 210 comprises at least one software function module which may be stored in the form of software or firmware in the second memory 230 or solidified in the operating system of the second terminal 200. The second processor 220 is configured to execute an executable module stored in the second memory 230, such as a software functional module or a computer program included in the second error handling device 210.
Please refer to fig. 4, which is a flowchart illustrating an error handling method applied to the first terminal 100 according to an embodiment of the present invention. It should be noted that the method provided by the present invention is not limited by the specific sequence shown in fig. 4 and described below. The respective steps shown in fig. 4 will be described in detail below.
Step S101, dividing data to be sent into a plurality of sub data packets, counting the total number of the sub data packets and obtaining the number and CRC value of each sub data packet.
In this embodiment, since the size of the data packet allowed to be sent by the UDP communication interface is fixed each time, in order to avoid that the size of the data to be sent exceeds the preset sending size of the UDP communication interface, the first terminal 100 splits the data to be sent into a plurality of sub-packets, so that the plurality of sub-packets can be smoothly sent to the second terminal 200 through the UDP communication interface in the following.
Optionally, in this embodiment, the first terminal 100 counts the total packet number of the split sub-packets, and records the number of each sub-packet. For example, the split sub-packets are recorded as n1、n2、…、ni、…、nMThen, the total number of the sub-packets after being split is M, where 1, 2, …, i, …, and M are the numbers of the sub-packets, respectively. And the first terminal 100 may further calculate a Cyclic Redundancy Check (CRC) value corresponding to each sub-packet, so that the second terminal 200 can verify the correctness of each sub-packet according to the CRC value of each sub-packet.
Step S103, assembling a header data packet, writing the total packet number, the number and the CRC value of each sub data packet, and the CRC value of the header data packet into the header data packet, and sending the header data packet to the second terminal 200, so that the second terminal 200 checks the correctness of the header data packet according to the CRC value of the header data packet.
Optionally, the first terminal 100 assembles a header data packet, for example, selects a first sub-packet, and writes the total packet number M of the sub-packet, the number of each sub-packet, the CRC value of each sub-packet, and the CRC value of the sub-packet into the header of the sub-packet to generate the header data packet. The first terminal 100 transmits the assembled header packet to the second terminal 200.
After receiving the header data packet sent by the first terminal 100, the second terminal 200 checks the correctness of the header data packet according to the CRC value of the header data packet, if the check result indicates that the header data packet is correct, the second terminal retains and stores the header data packet, sends feedback information that the header data packet has been normally received to the first terminal 100, and prepares to sequentially receive each sub data packet according to the number of the sub data packet. If the second terminal 200 detects that the header packet is incorrect, the header packet is discarded.
Step S105, detecting whether first feedback information, which is sent by the second terminal 200 and indicates that the header data packet is normally received, is received within a first preset time, and if the first feedback information sent by the second terminal 200 is received, sending the plurality of sub-packets to the second terminal 200, respectively, so that the second terminal 200 checks the correctness and integrity of the received sub-packets according to the total number of the packets, the numbers of the sub-packets, and the CRC value.
Optionally, after sending the assembled header packet to the second terminal 200, the first terminal 100 starts timing, and detects whether the first feedback information indicating that the header data has been normally received, sent by the second terminal 200, is received within a first preset time after the timing is started by successfully sending the header packet. And if the first feedback information sent by the second terminal 200 is not received, the header data packet is sent to the second terminal 200 again. If the feedback information sent by the second terminal 200 is received, the plurality of sub-packets are sent to the second terminal 200, respectively.
Optionally, after the first terminal 100 retransmits the header packet to the second terminal 200, it detects whether the number of times of transmitting the header packet reaches a preset number of times, and if the number of times of transmitting the header packet reaches the preset number of times and the second terminal 200 has no response of feedback, it determines that the data transmission operation has failed, and ends the process.
Optionally, referring to fig. 5, in this embodiment, the error processing method further includes the following steps:
step S201, detecting whether second feedback information, which is sent by the second terminal 200 and indicates that the sub-packet has been normally received, is received within a second preset time, and if the second feedback information sent by the second terminal 200 is not received, resending the sub-packet to the second terminal 200.
Step S203, detecting whether the sending times of the sub data packet reaches a preset time, and if the sending times reaches the preset time, determining that the sending of the sub data packet fails.
Optionally, in this embodiment, after the first terminal 100 sends each sub-packet to the second terminal 200, it is unable to determine whether the second terminal 200 has normally received the sub-packet. Therefore, after the first terminal 100 sends the sub-packet to the second terminal 200, it is detected whether the second feedback information indicating that the sub-packet has been normally received and sent by the second terminal 200 is received within a second preset time period since the sub-packet is sent and timing is started. And if the feedback information sent by the second terminal 200 is not received, resending the sub-data packet to the second terminal 200. If feedback information indicating that a certain sub-packet has been normally received, which is sent by the second terminal 200, is received, the sending of other sub-packets is continued.
Optionally, after the first terminal 100 retransmits the sub-packet that is not normally received by the second terminal 200 to the second terminal 200, the first terminal 100 detects whether the transmission frequency of the sub-packet reaches a preset frequency, and if the preset frequency is reached and the second terminal 200 has not responded to the feedback, it determines that the sub-packet is failed to be transmitted.
Optionally, in this embodiment, the error processing method further includes the following steps:
and when third feedback information which indicates that the received sub-packet is erroneous and is sent by the second terminal 200 is received, the sub-packet is sent to the second terminal 200 again.
In this embodiment, after the first terminal 100 sends the sub-packets to the second terminal 200, the second terminal 200 checks the correctness of the received sub-packets according to the numbers and CRC values of the sub-packets carried in the previously received header data packet.
Optionally, the second terminal 200 detects whether the number of the received sub-packet is consistent with the number of the set to-be-received data packet, and if not, discards the sub-packet. If yes, then detecting whether the CRC value of the sub-data packet is consistent with the CRC value of the sub-data packet with the same number in the previously received head data packet. If the data packet is consistent with the data packet, judging that the received data packet is correct, and storing the data packet. And transmits feedback information that the sub-packets are correct to the first terminal 100.
Alternatively, if the second terminal 200 determines that the received sub packet is erroneous, a response indicating that the received sub packet is erroneous is sent to the first terminal 100. When the first terminal 100 receives the third feedback information indicating that the received sub-packet is erroneous, which is sent by the second terminal 200, the sub-packet is sent to the second terminal 200 again.
Optionally, in this embodiment, the error processing method further includes the following steps:
and when receiving fourth feedback information indicating that the sub-packets are missing, which is sent by the second terminal 200, the missing sub-packets are sent to the second terminal 200 again.
In this embodiment, after the first terminal 100 sends the plurality of subpackets to the second terminal 200, the second terminal 200 verifies the correctness of the subpackets, that is, checks the integrity of the received subpackets that have been verified by the correctness according to the total packet number of the subpackets carried in the header packet.
Optionally, when starting to receive the subpacket, the second terminal 200 counts whether the packet number of the subpacket received within a third preset time from the timing reaches the total packet number of the subpackets carried in the header packet, that is, the total packet number M. If the total number of the sub-packets is reached, it is determined that all the sub-packets have been received, and a response that all the sub-packets have been successfully received is sent to the first terminal 100, and the data transmission operation is ended. If the packet number of the received sub data packets does not reach the total packet number within the third preset time, the second terminal 200 checks the received data record, finds out the sub data packets which are not normally received, and feeds back a corresponding data sending request to the first terminal 100.
When receiving the fourth feedback information indicating that the sub-packet is missing, which is sent by the second terminal 200, the first terminal 100 resends the missing sub-packet to the second terminal 200. For example, the first terminal 100 receives the transmission sub-packet n of the second terminal 200iWhen requested, the sub-data packet n is then sentiAnd re-sent to the second terminal 200.
Optionally, in this embodiment, when the second terminal 200 starts to receive the sub-packets, if the second terminal 200 still does not normally receive all the sub-packets within the fourth preset time, it is determined that the data reception fails this time. And the fourth preset time is greater than the third preset time.
Referring to fig. 6, a flowchart of an error handling method applied to the second terminal 200 according to an embodiment of the present invention is provided. It should be noted that the method provided by the present invention is not limited by the specific sequence shown in fig. 6 and described below.
Step S301, receiving a header data packet sent by the first terminal 100, where the header data includes a total packet number of the multiple sub data packets, a number and a CRC value of each sub data packet, and a CRC value of the header data packet.
Step S303, detecting whether the header data packet is correct according to the CRC value of the header data packet, and if the header data packet is correct, sending a response that the header data packet is normally received to the first terminal 100, so that the first terminal 100 sends the plurality of sub data packets to the second terminal 200.
Step S305, receiving the sub data packet sent by the first terminal 100, and detecting whether the received sub data packet is correct according to the number and CRC value of each sub data packet in the header data packet.
Step S307, detecting whether the received sub data packet is complete according to the total packet number in the header data packet.
Optionally, referring to fig. 7, in the present embodiment, the step S305 includes three substeps, namely a step S3051, a step S3053 and a step S3055.
Step S3051, detecting whether the number of the received sub data packet is consistent with the number of the set data packet to be received, if not, executing the following step S3053, and if so, executing the following step S3055.
Step S3053, discard the sub-packet.
Step S3055, detecting whether the CRC value of the sub data packet is consistent with the CRC value of the sub data packet having the same number as the sub data packet in the header data packet, and if so, determining that the sub data packet is correct.
Optionally, in this embodiment, step S307 may include the following sub-steps:
counting whether the number of the sub-data packets received within the third preset time reaches the total number of the sub-data packets, and if so, judging that the received sub-data packets are complete.
In this embodiment, if the number of sub-packets received within the third preset time does not reach the total number of sub-packets, the error handling method further includes the following steps:
finding the sub-packets which are not normally received, and sending a request to the first terminal 100, so that the first terminal 100 sends the sub-packets which are not normally received.
In this embodiment, the error processing method applied to the second terminal 200 further includes the steps of:
and counting whether the packet number of the sub-packets received within a fourth preset time reaches the total packet number, wherein the fourth preset time is longer than the third preset time, and if the total packet number is not reached, determining that the data reception fails.
For other details of the error processing method applied to the second terminal 200 in this embodiment, further reference may be made to the description in the above embodiment of the error processing method applied to the first terminal 100, which is not described herein again.
Referring to fig. 8, a functional block diagram of a first error handling apparatus 110 applied to a first terminal 100 according to an embodiment of the present invention is shown. The first error handling apparatus 110 comprises a splitting module 111, an assembling module 112, a first detecting module 113 and a sending module 114.
The splitting module 111 is configured to split data to be sent into a plurality of sub data packets, count the total number of sub data packets, and obtain the number and CRC value of each sub data packet.
The assembling module 112 is configured to assemble a header data packet, write the total packet number, the serial number and the CRC value of each sub data packet, and the CRC value of the header data packet into the header data packet, and send the header data packet to the second terminal 200, so that the second terminal 200 checks the correctness of the header data packet according to the CRC value of the header data packet.
The first detecting module 113 is configured to detect whether first feedback information, which is sent by the second terminal 200 and indicates that the header data packet is received normally, is received within a first preset time.
The sending module 114 is configured to send the multiple subpackets to the second terminal 200 respectively when receiving the first feedback information sent by the second terminal 200, so that the second terminal 200 checks the correctness and integrity of the received subpackets according to the total packet number, the number of each subpacket, and the CRC value.
For other details of the first error processing apparatus 110 in this embodiment, reference may be further made to the description in the above embodiment of the error processing method applied to the first terminal 100, and details are not repeated here.
Referring to fig. 9, a functional block diagram of a second error processing apparatus 210 applied to a second terminal 200 according to an embodiment of the present invention is shown. The error handling apparatus includes a receiving module 211, a header packet detecting module 212, a response module 213, a second detecting module 214, and a third detecting module 215.
The receiving module 211 is configured to receive a header data packet sent by the first terminal 100, where the header data includes a total packet number of the multiple sub data packets, a number and a CRC value of each sub data packet, and a CRC value of the header data packet.
The header packet detection module 212 is configured to detect whether the header packet is correct according to the CRC value of the header packet.
The response module 213 is configured to send a response that the header data packet is normally received to the first terminal 100 when the header data packet is correct, so that the first terminal 100 sends the plurality of sub data packets to the second terminal 200.
The second detecting module 214 is configured to receive the sub data packets sent by the first terminal 100, and detect whether the received sub data packets are correct according to the numbers and CRC values of the sub data packets in the header data packet.
The third detecting module 215 is configured to detect whether the received sub data packet is complete according to the total number of packets in the header data packet.
For other details of the second error handling apparatus 210 in this embodiment, reference may be further made to the description in the above-mentioned embodiment of the error handling method applied to the first terminal 100, and details are not repeated here.
In summary, according to the error processing method and apparatus provided by the present invention, the first terminal 100 writes the related information of the sub-packets into the header packet and sends the header packet to the second terminal 200, and after detecting the correctness of the header packet, the second terminal 200 sends the acknowledgement information to the first terminal 100, so that the first terminal 100 sends the sub-packets. The second terminal 200 checks the correctness and integrity of the received sub-packet according to the related information of the sub-packet carried in the header packet. The error processing scheme provided by the invention avoids the defect of unreliable data information in a UDP communication mode through checking the correctness of the header data packet and checking the correctness and the integrity of the sub data packet, improves the correctness and the integrity of data transmission, and can realize the transmission of complete and correct data in a unicast, broadcast, multicast and cross-network segment mode.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. The apparatus embodiments described above are merely illustrative and, for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
The above description is only for the specific embodiments of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present invention, and all the changes or substitutions should be covered within the scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the appended claims.

Claims (10)

1. An error handling method applied to a first terminal communicatively connected to a second terminal via a UDP protocol, the error handling method comprising:
splitting data to be sent into a plurality of sub data packets, counting the total number of the sub data packets and obtaining the number and CRC value of each sub data packet;
assembling a header data packet, writing the total packet number, the serial number and the CRC value of each sub data packet and the CRC value of the header data packet into the header data packet, and sending the header data packet to the second terminal so that the second terminal can check the correctness of the header data packet according to the CRC value of the header data packet;
and detecting whether first feedback information which is sent by the second terminal and indicates that the head data packet is normally received is received or not within a first preset time, if the first feedback information sent by the second terminal is received, respectively sending the plurality of sub data packets to the second terminal so that the second terminal can check the integrity of the received sub data packets according to the total packet number and the packet number of the received sub data packets, and checking the correctness of the received sub data packets according to the number and the CRC value of the sub data packets carried in the head data packet and the number and the CRC value of each received sub data packet.
2. The error handling method of claim 1, wherein the method further comprises:
detecting whether second feedback information which is sent by the second terminal and indicates that the sub-data packet is normally received is received or not within second preset time;
if the second feedback information sent by the second terminal is not received, the sub-data packet is sent to the second terminal again;
and detecting whether the sending times of the sub-data packets reach preset times or not, and if so, judging that the sending of the sub-data packets fails.
3. The error handling method of claim 1, wherein the method further comprises:
and when third feedback information which is sent by the second terminal and indicates that the received sub-data packet is wrong is received, the sub-data packet is sent to the second terminal again.
4. The error handling method of claim 1, wherein the method further comprises:
and when receiving fourth feedback information which is sent by the second terminal and indicates that the sub-packets are missing, resending the missing sub-packets to the second terminal.
5. An error handling method, applied to a second terminal communicatively connected to a first terminal through a UDP protocol, where the first terminal has a plurality of subpackets prestored therein, and the error handling method includes:
receiving a header data packet sent by the first terminal, wherein the header data includes a total packet number of the plurality of sub data packets, a number and a CRC value of each sub data packet, and a CRC value of the header data packet;
detecting whether the header data packet is correct or not according to the CRC value of the header data packet, if so, sending a response of normal reception of the header data packet to the first terminal so that the first terminal sends the plurality of sub data packets to the second terminal;
receiving the sub data packets sent by the first terminal, and detecting whether the received sub data packets are correct or not according to the number and the CRC value of each sub data packet in the header data packet and the number and the CRC value of each received sub data packet;
and detecting whether the received sub data packet is complete or not according to the total packet number in the head data packet and the packet number of the received sub data packet.
6. The error processing method of claim 5, wherein the step of detecting whether the received sub-packet is correct according to the number and the CRC value of each sub-packet in the header packet and the number and the CRC value of each received sub-packet comprises:
and detecting whether the number of the received sub-data packet is consistent with the number of the set data packet to be received, if not, discarding the sub-data packet, if so, detecting whether the CRC value of the sub-data packet is consistent with the CRC value of the sub-data packet with the same number as the sub-data packet in the header data packet, and if so, judging that the sub-data packet is correct.
7. The error handling method of claim 5, wherein the step of detecting whether the received subpacket is complete according to the total number of packets in the header packet and the number of packets in the received subpacket comprises:
counting whether the number of the sub-data packets received within a third preset time reaches the total number of the sub-data packets, and if so, judging that the received sub-data packets are complete;
if the total number of packets is not reached, the method further comprises:
and finding the sub-data packets which are not normally received, and sending a request to the first terminal so that the first terminal sends the sub-data packets which are not normally received.
8. The error handling method of claim 7, wherein the method further comprises:
counting whether the number of sub-data packets received within a fourth preset time reaches the total number of sub-data packets, wherein the fourth preset time is longer than the third preset time;
if the total number of the packets is not reached, the data receiving fails.
9. An error handling apparatus, applied to a first terminal communicatively connected to a second terminal via a UDP protocol, the apparatus comprising:
the splitting module is used for splitting the data to be sent into a plurality of sub data packets, counting the total number of the sub data packets and obtaining the serial number and the CRC value of each sub data packet;
the assembling module is used for assembling a head data packet, writing the total packet number, the serial number and the CRC value of each sub-data packet and the CRC value of the head data packet into the head data packet, and sending the head data packet to the second terminal so that the second terminal can check the correctness of the head data packet according to the CRC value of the head data packet;
the first detection module is used for detecting whether first feedback information which is sent by the second terminal and indicates that the header data packet is normally received is received within first preset time;
and the sending module is used for sending the plurality of sub-data packets to the second terminal respectively when first feedback information sent by the second terminal is received, so that the second terminal can check the integrity of the received sub-data packets according to the total packet number and the packet number of the received sub-data packets, and can check the correctness of the received sub-data packets according to the number and the CRC value of the sub-data packets carried in the header data packet and the number and the CRC value of each received sub-data packet.
10. An error handling apparatus, applied to a second terminal communicatively connected to a first terminal through a UDP protocol, wherein the first terminal has a plurality of subpackets prestored therein, the error handling apparatus comprising:
a receiving module, configured to receive a header data packet sent by the first terminal, where the header data includes a total packet number of the multiple sub data packets, a number and a CRC value of each sub data packet, and a CRC value of the header data packet;
a header packet detection module, configured to detect whether the header packet is correct according to a CRC value of the header packet;
a response module, configured to send a response that the header data packet is normally received to the first terminal when the header data packet is correct, so that the first terminal sends the multiple sub data packets to the second terminal;
a second detection module, configured to receive the sub data packet sent by the first terminal, and detect whether the received sub data packet is correct according to the number and the CRC value of each sub data packet in the header data packet and the number and the CRC value of each received sub data packet;
and the third detection module is used for detecting whether the received sub data packet is complete or not according to the total packet number in the head data packet and the packet number of the received sub data packet.
CN201710632119.4A 2017-07-28 2017-07-28 Error processing method and device Active CN107483148B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710632119.4A CN107483148B (en) 2017-07-28 2017-07-28 Error processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710632119.4A CN107483148B (en) 2017-07-28 2017-07-28 Error processing method and device

Publications (2)

Publication Number Publication Date
CN107483148A CN107483148A (en) 2017-12-15
CN107483148B true CN107483148B (en) 2020-10-13

Family

ID=60597827

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710632119.4A Active CN107483148B (en) 2017-07-28 2017-07-28 Error processing method and device

Country Status (1)

Country Link
CN (1) CN107483148B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110611644A (en) * 2018-06-15 2019-12-24 视联动力信息技术股份有限公司 Data transmission method and device
CN110868276A (en) * 2018-08-28 2020-03-06 京东数字科技控股有限公司 Data transmission method and system for Internet of things equipment and electronic equipment
WO2021035811A1 (en) * 2019-08-27 2021-03-04 江苏华存电子科技有限公司 Memory control method with variable bit rate and correction capability
CN113360435A (en) * 2021-06-03 2021-09-07 三川智慧科技股份有限公司 Serial port communication optimization method, device, equipment and medium for intelligent water meter

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2100458B1 (en) * 2007-01-06 2019-03-27 Samsung Electronics Co., Ltd. Method and apparatus for controlling intra-refreshing in a video telephony communication system
CN102143073A (en) * 2011-03-23 2011-08-03 深圳创维数字技术股份有限公司 Data transmission method and system
CN105846982B (en) * 2016-04-29 2019-03-15 国家计算机网络与信息安全管理中心 A kind of method of cross-domain transmission

Also Published As

Publication number Publication date
CN107483148A (en) 2017-12-15

Similar Documents

Publication Publication Date Title
CN107483148B (en) Error processing method and device
EP3840265B1 (en) Method and apparatus for feeding back hybrid automatic repeat request of downlink data
CN104539739B (en) A kind of system, method and device that file uploads
US9622147B2 (en) System and method for performing hybrid automatic repeat request (HARQ) in a WLAN system
JP6148459B2 (en) How to transport data from a source node to a destination node
JP2615509B2 (en) Communication device
CN113132063B (en) Physical layer retransmission control method
JP5020952B2 (en) Wireless communication apparatus and method used in mobile communication system
JP2015027100A (en) Transmission control method for packet communication, and packet communication system
US20110041025A1 (en) Method of communication, in particular with capability of frame abortion or retransmission indication, between a transmitter and a receiver based on frames and corresponding communication node
US11297529B2 (en) Toggling based indicator of reception success
US20170005757A1 (en) Data transmission and feedback processing method and apparatus
US10014980B2 (en) Communication device and communication system
US8370443B2 (en) Reliable messaging using publish subscribe mechanism
CN114095117A (en) Retransmission method and related device for Ethernet error frame
WO2017024528A1 (en) Method for transmitting feedback information, user equipment and access device
JP2005286832A (en) Atm communication system and atm communication method
WO2005069528A1 (en) Communication system, data retransmission control method thereof, and wireless transmitting/receiving apparatus used therein
CN113364880A (en) Information exchange method, system, electronic device and storage medium
JP2011009827A (en) Communication system and communication method
EP2405627B1 (en) Method for operating a remote procedure call handler in a client and a server and computer system comprising the same
CN117040692A (en) Method and device for transmitting service data, electronic equipment and storage medium
KR101460183B1 (en) System and Method for Message Service with Reliability
WO2015064288A1 (en) Wireless communication device, wireless communication system, and wireless communication method thereof
JP2005217487A (en) Packet transmission system and apparatus

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