CN114785462A - Communication method for preventing packet loss - Google Patents

Communication method for preventing packet loss Download PDF

Info

Publication number
CN114785462A
CN114785462A CN202210384367.2A CN202210384367A CN114785462A CN 114785462 A CN114785462 A CN 114785462A CN 202210384367 A CN202210384367 A CN 202210384367A CN 114785462 A CN114785462 A CN 114785462A
Authority
CN
China
Prior art keywords
data packet
server
copy
client
packet
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.)
Pending
Application number
CN202210384367.2A
Other languages
Chinese (zh)
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.)
Guangzhou Guoxun Robot Technology Co ltd
Original Assignee
Guangzhou Guoxun Robot Technology 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 Guangzhou Guoxun Robot Technology Co ltd filed Critical Guangzhou Guoxun Robot Technology Co ltd
Priority to CN202210384367.2A priority Critical patent/CN114785462A/en
Publication of CN114785462A publication Critical patent/CN114785462A/en
Pending legal-status Critical Current

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/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/188Time-out mechanisms
    • 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/1607Details of the supervisory signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • 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/163In-band adaptation of TCP data exchange; In-band control procedures

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明公开一种防丢包的通信方法,包括以下步骤:客户端通过通信设备向服务器发起连接请求;服务器响应连接请求,客户端通过心跳与服务器维持长连接;客户端向服务器发送预检测数据包副本并保存数据包副本;服务器接收并校验数据包副本;数据包副本校验通过后,客户端向服务器发送数据包正本;服务器接收保存并校验数据包正本;数据包正本校验通过,数据包接收成功;客户端删除数据包副本。本发明提供的一种防丢包的通信方法,可保障通信质量,使数据准确无误的发送,以确保依赖通讯的设备、服务,能够减少网络质量的依赖,减少网络问题引发的故障、错误。

Figure 202210384367

The invention discloses a communication method for preventing packet loss, comprising the following steps: a client initiates a connection request to a server through a communication device; the server responds to the connection request, and the client maintains a long connection with the server through heartbeat; the client sends pre-detection data to the server Packet copy and save the data packet copy; the server receives and verifies the data packet copy; after the data packet copy verification is passed, the client sends the original data packet to the server; the server receives and saves and verifies the original data packet; the original data packet verification passes , the packet is received successfully; the client deletes the copy of the packet. The invention provides a communication method for preventing packet loss, which can ensure communication quality, enable data to be sent accurately, ensure equipment and services relying on communication, reduce dependence on network quality, and reduce failures and errors caused by network problems.

Figure 202210384367

Description

一种防丢包的通信方法A communication method for preventing packet loss

技术领域technical field

本发明涉及通信技术领域,具体涉及一种防丢包的通信方法。The present invention relates to the technical field of communication, in particular to a communication method for preventing packet loss.

背景技术Background technique

无线网络通信过程中,由于外界因素影响,常常容易受到干扰,容易引发丢包现象,从而使得依赖于网络通信的设备、服务等失去控制,得不到有效的指令,引发故障。In the process of wireless network communication, due to the influence of external factors, it is often susceptible to interference, which can easily lead to packet loss, so that equipment and services that depend on network communication are out of control, and effective instructions cannot be obtained, causing failures.

发明内容SUMMARY OF THE INVENTION

本发明的目的在于克服现有技术的不足,提供一种防丢包的通信方法,可保障通信质量,使数据准确无误的发送,以确保依赖通讯的设备、服务,能够减少网络质量的依赖,减少网络问题引发的故障、错误。The purpose of the present invention is to overcome the deficiencies of the prior art, and to provide a communication method for preventing packet loss, which can ensure the quality of communication, enable accurate data transmission, ensure equipment and services that rely on communication, and reduce the dependence on network quality. Reduce failures and errors caused by network problems.

本发明的技术方案如下:The technical scheme of the present invention is as follows:

一种防丢包的通信方法,包括以下步骤:A communication method for preventing packet loss, comprising the following steps:

客户端通过通信设备向服务器发起连接请求;The client initiates a connection request to the server through the communication device;

服务器响应连接请求,客户端通过心跳与服务器维持长连接;The server responds to the connection request, and the client maintains a long connection with the server through heartbeat;

客户端向服务器发送预检测数据包副本并保存数据包副本;The client sends a copy of the pre-detected data packet to the server and saves the copy of the data packet;

服务器接收并校验数据包副本;The server receives and verifies the copy of the data packet;

数据包副本校验通过后,客户端向服务器发送数据包正本;After the verification of the copy of the data packet is passed, the client sends the original of the data packet to the server;

服务器接收保存并校验数据包正本;The server receives and saves and verifies the original data packet;

数据包正本校验通过,数据包接收成功;The original verification of the data packet is passed, and the data packet is received successfully;

客户端删除数据包副本。The client deletes the packet copy.

其中,客户端与服务器之间基于TCP通信协议连接。The connection between the client and the server is based on the TCP communication protocol.

其中,数据包基于十六进制字节,每个字节所在数据包的位置和数据,客户端和服务器均有对应的字典转换和解析。Among them, the data packet is based on hexadecimal bytes, and the client and server have corresponding dictionary conversion and parsing for the location and data of the data packet where each byte is located.

其中,数据包副本、数据包正本均采用相同校验算法。Among them, the copy of the data packet and the original of the data packet use the same verification algorithm.

其中,若数据包副本校验不通过,客户端则无法向服务器发送数据包正本。Among them, if the verification of the copy of the data packet fails, the client cannot send the original of the data packet to the server.

其中,若数据包正本校验超时,客户端重新向服务器发送数据包正本。Among them, if the verification of the original data packet times out, the client re-sends the original data packet to the server.

其中,若数据包正本校验不通过,服务器将不作回复。Among them, if the original verification of the data packet fails, the server will not reply.

相对于现有技术,本发明的有益效果在于:Compared with the prior art, the beneficial effects of the present invention are:

1、客户端基于TCP通信协议通过心跳与服务器维持长连接,可以减少TCP连接繁琐的握手机制;1. The client maintains a long connection with the server through heartbeat based on the TCP communication protocol, which can reduce the cumbersome handshake mechanism of the TCP connection;

2、数据包简化,数据包基于十六进制字节,每个字节所在数据包的位置和数据,客户端和服务器均有对应的字典转换和解析,因此,几个字节简单的数据包通过字典即可转换成较为复杂的语义进行逻辑处理,传输的数据量大量减少,数据包对良好网络状态的依赖将会得到缓解;2. The data packet is simplified. The data packet is based on hexadecimal bytes. The location and data of the data packet where each byte is located. Both the client and the server have corresponding dictionary conversion and parsing. Therefore, a few bytes of simple data Packets can be converted into more complex semantics for logical processing through the dictionary, the amount of transmitted data is greatly reduced, and the dependence of data packets on good network status will be alleviated;

3、数据包副本、数据包正本均采用相同的校验算法,可以核对数据包是否完整;3. The same verification algorithm is used for the copy of the data packet and the original of the data packet, which can check whether the data packet is complete;

4、客户端在发送数据包正本之前先发送数据包副本,并对数据包副本进行保存,在校验通过后再向服务器发送数据包正本,服务器接收保存并校验数据包正本,数据包正本校验通过后,客户端才会释放数据包副本,达到了防丢包的效果。4. The client sends a copy of the data packet before sending the original of the data packet, and saves the copy of the data packet. After the verification is passed, it sends the original of the data packet to the server. The server receives and saves and verifies the original of the data packet. After the verification is passed, the client will release the copy of the data packet, which achieves the effect of preventing packet loss.

附图说明Description of drawings

为了更清楚地说明本发明实施例中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the technical solutions in the embodiments of the present invention more clearly, the following briefly introduces the accompanying drawings that need to be used in the description of the embodiments or the prior art. Obviously, the drawings in the following description are only for the present invention. In some embodiments, for those of ordinary skill in the art, other drawings can also be obtained according to these drawings without any creative effort.

图1为本发明的方法流程图。FIG. 1 is a flow chart of the method of the present invention.

具体实施方式Detailed ways

为了使本发明的目的、技术方案及优点更加清楚明白,以下结合附图及实施例对本发明进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本发明,并不用于限定本发明。In order to make the objectives, technical solutions and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present invention, but not to limit the present invention.

为了说明本发明所述的技术方案,下面通过具体实施例来进行说明。In order to illustrate the technical solutions of the present invention, the following specific embodiments are used for description.

实施例Example

请参阅图1,本实施例提供一种防丢包的通信方法,包括以下步骤:Referring to FIG. 1, this embodiment provides a communication method for preventing packet loss, including the following steps:

客户端通过通信设备向服务器发起TCP连接请求;The client initiates a TCP connection request to the server through the communication device;

服务器响应TCP连接请求,客户端通过心跳与服务器维持长连接;The server responds to the TCP connection request, and the client maintains a long connection with the server through heartbeat;

客户端向服务器发送预检测数据包副本并保存数据包副本;The client sends a copy of the pre-detected data packet to the server and saves the copy of the data packet;

服务器接收并校验数据包副本;The server receives and verifies the copy of the data packet;

数据包副本校验通过后,客户端向服务器发送数据包正本,若数据包副本校验不通过,客户端则无法向服务器发送数据包正本;After the verification of the copy of the data packet is passed, the client sends the original of the data packet to the server. If the verification of the copy of the data packet fails, the client cannot send the original of the data packet to the server;

服务器接收保存并校验数据包正本,若数据包正本校验超时,客户端重新向服务器发送数据包正本;The server receives, saves and verifies the original data packet. If the original data packet verification times out, the client sends the original data packet to the server again;

数据包正本校验通过,数据包接收成功,若数据包正本校验不通过,服务器将不作回复;If the original verification of the data packet passes, the data packet is received successfully. If the original verification of the data packet fails, the server will not reply;

数据包接收成功后,客户端删除数据包副本。After the packet is received successfully, the client deletes the copy of the packet.

该方法基于TCP通信协议,采用长连接、简化数据包、校验数据包、中间存储与多次确认接收的方式达到防丢包的效果。The method is based on the TCP communication protocol, and adopts the methods of long connection, simplified data packet, verification data packet, intermediate storage and multiple confirmation reception to achieve the effect of preventing packet loss.

原理:principle:

1、客户端基于TCP通信协议通过心跳与服务器维持长连接,可以减少TCP连接繁琐的握手机制;1. The client maintains a long connection with the server through heartbeat based on the TCP communication protocol, which can reduce the cumbersome handshake mechanism of the TCP connection;

2、数据包简化,数据包基于十六进制字节,每个字节所在数据包的位置和数据,客户端和服务器均有对应的字典转换和解析,因此,几个字节简单的数据包通过字典即可转换成较为复杂的语义进行逻辑处理,传输的数据量大量减少,数据包对良好网络状态的依赖将会得到缓解;2. The data packet is simplified. The data packet is based on hexadecimal bytes. The location and data of the data packet where each byte is located. Both the client and the server have corresponding dictionary conversion and parsing. Therefore, a few bytes of simple data Packets can be converted into more complex semantics for logical processing through the dictionary, the amount of transmitted data is greatly reduced, and the dependence of data packets on good network status will be alleviated;

3、数据包副本、数据包正本均采用相同的校验算法,可以核对数据包是否完整;3. The same verification algorithm is used for the copy of the data packet and the original of the data packet, which can check whether the data packet is complete;

4、客户端在发送数据包正本之前先发送数据包副本,并对数据包副本进行保存,在校验通过后再向服务器发送数据包正本,服务器接收保存并校验数据包正本,数据包正本校验通过后,客户端才会释放数据包副本,达到了防丢包的效果。4. The client sends a copy of the data packet before sending the original of the data packet, and saves the copy of the data packet. After the verification is passed, it sends the original of the data packet to the server. The server receives and saves and verifies the original of the data packet. After the verification is passed, the client will release the copy of the data packet, which achieves the effect of preventing packet loss.

以上仅为本发明的较佳实施例而已,并不用于限制本发明,凡在本发明的精神和原则之内所作的任何修改、等同替换和改进等,均应包含在本发明的保护范围之内。The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent replacements and improvements made within the spirit and principles of the present invention shall be included in the protection scope of the present invention. Inside.

Claims (7)

1. A communication method for preventing packet loss is characterized by comprising the following steps:
a client initiates a connection request to a server through communication equipment;
the server responds to the connection request, and the client maintains long connection with the server through heartbeat;
the client sends a copy of the pre-detection data packet to the server and stores the copy of the data packet;
the server receives and verifies the data packet copy;
after the data packet copy passes the verification, the client sends a data packet original to the server;
the server receives, stores and verifies the original copy of the data packet;
the data packet is successfully received after the positive copy of the data packet passes the verification;
the client deletes the packet copy.
2. The communication method for preventing the lost packet according to claim 1, wherein the connection between the client and the server is based on a TCP communication protocol.
3. The method of claim 1, wherein the data packets are based on hexadecimal bytes, the location and data of the data packet where each byte is located, and corresponding dictionary conversion and parsing are provided for the client and the server.
4. The method according to claim 1, wherein the duplicate of the data packet and the original of the data packet both use the same checking algorithm.
5. The method of claim 1, wherein if the duplicate of the data packet fails to be checked, the client is unable to send the original data packet to the server.
6. The method according to claim 1, wherein the client resends the packet original to the server if the packet original check times out.
7. The method of claim 1, wherein if the data packet's true copy is not verified, the server does not reply.
CN202210384367.2A 2022-04-13 2022-04-13 Communication method for preventing packet loss Pending CN114785462A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210384367.2A CN114785462A (en) 2022-04-13 2022-04-13 Communication method for preventing packet loss

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210384367.2A CN114785462A (en) 2022-04-13 2022-04-13 Communication method for preventing packet loss

Publications (1)

Publication Number Publication Date
CN114785462A true CN114785462A (en) 2022-07-22

Family

ID=82429263

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210384367.2A Pending CN114785462A (en) 2022-04-13 2022-04-13 Communication method for preventing packet loss

Country Status (1)

Country Link
CN (1) CN114785462A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115733901A (en) * 2022-10-31 2023-03-03 杭州思创汇联科技有限公司 A TCP/IP-based IoT device communication method

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1671094A (en) * 2004-03-15 2005-09-21 微软公司 Method and apparatus for responding to a spurious timeout
CN1964351A (en) * 2006-11-21 2007-05-16 珠海金山软件股份有限公司 A method to reduce network flow of game server by data package compression
CN104917786A (en) * 2014-03-11 2015-09-16 杭州雾隐美地传媒有限公司 Method and module for saving transmission flow during interaction of client and server
CN105573958A (en) * 2016-01-12 2016-05-11 西北工业大学 Reliable data interaction method based on RS-422 serial bus technique
CN107395620A (en) * 2017-08-17 2017-11-24 无锡清华信息科学与技术国家实验室物联网技术中心 A kind of network transmission encrypting and decrypting method based on random bytes mapping
CN111600927A (en) * 2020-04-03 2020-08-28 浙江工业大学 A method for service adaptive invocation in complex network environment
CN112565381A (en) * 2020-11-30 2021-03-26 杭州迪普科技股份有限公司 Data packet forwarding method, device and equipment
CN113190388A (en) * 2021-04-13 2021-07-30 厦门路桥信息股份有限公司 TCP interface test method, medium, equipment and device

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1671094A (en) * 2004-03-15 2005-09-21 微软公司 Method and apparatus for responding to a spurious timeout
CN1964351A (en) * 2006-11-21 2007-05-16 珠海金山软件股份有限公司 A method to reduce network flow of game server by data package compression
CN104917786A (en) * 2014-03-11 2015-09-16 杭州雾隐美地传媒有限公司 Method and module for saving transmission flow during interaction of client and server
CN105573958A (en) * 2016-01-12 2016-05-11 西北工业大学 Reliable data interaction method based on RS-422 serial bus technique
CN107395620A (en) * 2017-08-17 2017-11-24 无锡清华信息科学与技术国家实验室物联网技术中心 A kind of network transmission encrypting and decrypting method based on random bytes mapping
CN111600927A (en) * 2020-04-03 2020-08-28 浙江工业大学 A method for service adaptive invocation in complex network environment
CN112565381A (en) * 2020-11-30 2021-03-26 杭州迪普科技股份有限公司 Data packet forwarding method, device and equipment
CN113190388A (en) * 2021-04-13 2021-07-30 厦门路桥信息股份有限公司 TCP interface test method, medium, equipment and device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
是摸鱼啊: "GET 和 POST 的区别?", 《知乎》, pages 1 - 3 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115733901A (en) * 2022-10-31 2023-03-03 杭州思创汇联科技有限公司 A TCP/IP-based IoT device communication method

Similar Documents

Publication Publication Date Title
US6785259B2 (en) Enhanced transmission of critical data
US9661657B2 (en) TCP traffic adaptation in wireless systems
CN112911638B (en) Reliable communication method for optimizing wireless network load congestion by using UDP (user Datagram protocol)
CN112910856A (en) Communication protocol design method based on serial port communication
CN111711609A (en) A protocol design method in serial communication
WO2017190541A1 (en) Dictionary information synchronization method, apparatus and device
US10932159B2 (en) Data transmission method, data receiving device, and data sending device
CN101714991A (en) Method for realizing heartbeat mechanism
US20060221946A1 (en) Connection establishment on a tcp offload engine
CN108667486A (en) A Power Line Carrier Reliable Polling Communication Method
US10461892B2 (en) Low latency communications
CN114785462A (en) Communication method for preventing packet loss
US9949300B2 (en) Packet transmission method and system, and station
WO2020010511A1 (en) Data transmission method and base station
CN108173851A (en) An Efficient Multimedia Transmission Method for Spatial Information Network
CN109525374B (en) Data transmission method, wireless access point, user equipment and transmission equipment
WO2016196486A1 (en) Systems and methods for improved trivial file transfer protocol
JP3801879B2 (en) Retransmission control operation suppression method and retransmission control operation suppression device
WO2017143538A1 (en) Voice data transmission method and apparatus
WO2023056812A1 (en) Data processing method and device, and computer readable storage medium
CN107948303A (en) The processing method of http request failure on a kind of Android
WO2012155703A1 (en) Link parameter autonegotiation method, terminal and system based on hdlc protocol
WO2019015487A1 (en) Data retransmission method, rlc entity and mac entity
WO2017067224A1 (en) Packet processing method and apparatus
CN115065942B (en) Method and device for receiving and transmitting auxiliary broadcast network of mobile communication network

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
RJ01 Rejection of invention patent application after publication

Application publication date: 20220722