CN115941128A - Message protocol overtime retransmission management method based on QCache - Google Patents
Message protocol overtime retransmission management method based on QCache Download PDFInfo
- Publication number
- CN115941128A CN115941128A CN202211387223.9A CN202211387223A CN115941128A CN 115941128 A CN115941128 A CN 115941128A CN 202211387223 A CN202211387223 A CN 202211387223A CN 115941128 A CN115941128 A CN 115941128A
- Authority
- CN
- China
- Prior art keywords
- retransmission
- message
- frame
- qcache
- variable
- 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.)
- Granted
Links
- 238000007726 management method Methods 0.000 title claims abstract description 49
- 230000004044 response Effects 0.000 claims abstract description 27
- 230000005540 biological transmission Effects 0.000 claims description 17
- 238000000034 method Methods 0.000 claims description 13
- 230000006870 function Effects 0.000 claims description 8
- 230000008569 process Effects 0.000 claims description 7
- 101150055297 SET1 gene Proteins 0.000 claims description 2
- 238000012545 processing Methods 0.000 claims description 2
- 102000001327 Chemokine CCL5 Human genes 0.000 claims 1
- 108010055166 Chemokine CCL5 Proteins 0.000 claims 1
- 238000003780 insertion Methods 0.000 claims 1
- 230000037431 insertion Effects 0.000 claims 1
- 230000005012 migration Effects 0.000 claims 1
- 238000013508 migration Methods 0.000 claims 1
- 230000000875 corresponding effect Effects 0.000 description 3
- 230000002596 correlated effect Effects 0.000 description 2
- 238000013461 design Methods 0.000 description 2
- 230000007246 mechanism Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 238000012790 confirmation Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000003993 interaction Effects 0.000 description 1
Images
Landscapes
- Communication Control (AREA)
Abstract
The invention discloses a message protocol overtime retransmission management method based on QCache, which comprises the following steps: designing a message overtime retransmission protocol; defining a bus carrier; defining a retransmission management structure; defining a QCache type variable gSndQ; at a message sending end, when the message content is filled and retransmitted, defining a retransmission management structure variable and recording a message sequence number by the variable; in the message receiving thread, receiving the response frame and confirming the frame number, and searching the retransmission flag state in the retransmission management structure in the Qcache; traversing the Qcache frame number in the timer, and removing an element whether a retransmission flag in the message retransmission management structure body is negative; in the timer, adding one to the counter in the retransmission management structure, and when the residual value of the retransmission base number of the counter is the retransmission base number minus one, performing retransmission operation; and when the retransmission times reach the preset times, removing the key value corresponding to the frame sequence number from the gSndQ. The invention is efficient and accurate.
Description
Technical Field
The invention belongs to the technical field of computer control, and relates to a message protocol timeout retransmission management method based on QCache.
Background
QCache is a key-based data structure provided by the QT framework that, in comparison to the traditional key-value-pair satchella orange structures QHash and QMap, automatically takes ownership of objects inserted into the cache and deletes them if necessary to make room for new objects.
The message retransmission mechanism is a mechanism for ensuring that data can be reached after data error frame, disordered frame and frame loss occur in bus data interaction.
The traditional management of message retransmission overtime among systems usually adopts a mode of array marking to manage, for different message types, whether a response is needed is marked in the array after the message is sent, for the number of messages needing to be responded continuously increasing, the length of the array needs to be continuously increased, the increase of system operation load is caused, a timer needs to be started in a computer control system for counting, and the timer is used for judging the overtime response of different timing messages. When a message is retransmitted, information such as transmitted bus information, content, length and the like, which is generally a global common variable, needs to be found, and intermediate variables and data values transmitted from the first transmission to the timeout unanswered transmission may be tampered by other parts of the program, so that the contents of the data transmitted twice are not completely consistent.
Disclosure of Invention
Objects of the invention
The purpose of the invention is: the utility model provides a message protocol overtime retransmission management method based on QCache, solves the problem that the data content is not completely consistent when overtime is not answered.
(II) technical scheme
In order to solve the above technical problem, the present invention provides a message protocol timeout retransmission management method based on QCache, which includes the following steps:
s1: designing a message overtime retransmission protocol;
s2: defining a bus carrier BusInfo;
s3: defining a retransmission management structure MainReSend;
s4: defining a QCache variable gSndQ for storing the information sent out by the frame;
s5: at a message sending end, when the message content is filled and sent, judging whether the message needs to be retransmitted or not according to the response identifier, and when the message needs to be retransmitted, defining a retransmission management structure variable gMReSend and a SeqNum variable to record a message sequence number;
s6: in the message receiving thread, receiving the response frame, confirming the frame number, and searching the retransmission flag state in the retransmission management structure in the Qcache;
s7: traversing the Qcache frame number in the timer, and removing an element whether a retransmission flag in the message retransmission management structure body is negative;
s8: adding one to the counter in the retransmission management structure body in the timer, and performing retransmission operation when the residual value of the retransmission base number of the counter is that the retransmission base number is reduced by one;
s9: and when the retransmission times reach the preset times, removing the key value corresponding to the frame sequence number from the gSndQ.
(III) advantageous effects
The message protocol overtime retransmission management method based on the QCache has the advantages that based on the QCache key value pair data structure, all process information of message retransmission is recorded into the QCache data structure through a novel management structure, and management of overtime retransmission only needs to continuously inquire the message response state of the QCache data structure in a timer, so that overtime response management can be efficiently completed.
Drawings
Fig. 1 is a flowchart of a message protocol timeout retransmission management method based on QCache according to an embodiment of the present invention.
Detailed Description
In order to make the objects, contents and advantages of the present invention more apparent, the following detailed description of the present invention will be made in conjunction with the accompanying drawings and examples.
As shown in fig. 1, the message protocol timeout retransmission management method based on QCache in the present embodiment includes the following steps:
s1: design message timeout retransmission protocol
When the message needs to be retransmitted overtime, the designed protocol needs to have a response characteristic, and after the message is sent out, the destination node needs to reply a receiving confirmation frame after receiving the message.
S1_1 designs an intersystem packet protocol, which is defined as a variable length protocol, and includes a two-byte protocol header FrmHead (with identifiability, such as 0xFF and 0 xEE), a four-byte frame number FrmNum, which is ID-labeled using the frame number, which is a unique identification ID corresponding to a response frame, the ID retransmission times rechnt of one byte, the frame length FrmLen of two bytes (including all bytes from the header to the end of the frame), a two-byte frame type FrmType, a four-byte destination address FrmDst, a four-byte source address FrmSrc (destination and source address write IP address values), and a two-byte response identifier frmcnflag, which is used to indicate whether the frame needs to respond (if the two bytes are 0xFF00, it indicates that the frame needs to respond, and if the two bytes are 0x00FF, it indicates that the frame does not need to respond), a two-byte function code FrmCode (function code indicates the frame has the content of an indefinite number), a payload content frmfont of an indefinite extension, and two check bytes (frmhk) at the end of the frame, such as FrmCode, and a check method of FrmCode (FrmCode) using two check bits) and 0 mtc at the end (FrmCode).
S1_2 sets the header part and the tail part of the response frame ACK consistent with the message, and the content is the frame number of four bytes and the function code of two bytes. When the frame protocols of the sending frame and the response frame are correlated, the frame protocols are correlated by the frame sequence number, so that the response state of the frame can be traced clearly.
S2: defining a bus carrier BusInfo, wherein the BusInfo comprises two elements which are respectively (1) a bus type, the bus type is an enumeration type, 0 represents Ethernet transmission, 1 represents serial port transmission, 2 represents CAN bus transmission (2) destination address needing data transmission, the type is integer, and the bus type is determined as a destination IP address, a serial port number and a CAN bus port number.
S3: defining a retransmission management structure MainReSend, wherein the content of the structure is (1) the bus carrier BusInfo (2) defined in S2, and the memory address Addr of data to be transmitted is of an unsigned pointer type. (3) The retransmission flag isrennd is set to an unsigned character type, a value of 1 indicates that retransmission is required, a value of 0 indicates that retransmission is not required (4), a transmitted number count HaSnCnt is set to an unsigned integer, a number of times that this data has been transmitted (5) is required for retransmission, neSnCnt (if set to 0, this indicates that retransmission is not required), and this variable is set to an unsigned short integer.
S4: a QCache variable gSndQ is defined, which is used to store the information that the frame is sent out, wherein the type of key is set to integer (int type), the value is the frame number of the sent frame, the value is set to the structure type, and the structure is the retransmission management structure MainReSend defined in S3.
S5: and at the message sending end, when the message content is filled and sent, judging whether the response identifier FrmACKFlag is 0xFF00, if the judgment is failed, indicating that the message does not need to be retransmitted according to the response. If the judgment is successful, defining a retransmission management structure variable gMReSend and a SeqNum variable recording message sequence number.
Filling the content of a bus carrier in a variable gMReSend according to the type of a selected physical port (one of an Ethernet, a serial port and a CAN bus) and port address information (a port number obtains an IP address), assigning a first address gDataAddr of data to be transmitted to the content of an Addr in a structure body, setting a flag of whether to retransmit the data in the structure body to TURE (the value is SET to 1 to indicate retransmission is needed), setting the number of TIMES of retransmission HaSnCnt in the structure body to 0, setting the number of TIMES of retransmission NeSnCnt in the structure body to TIMES _ SET, and waiting for traversing inquiry later when using a QCache insert () method to send a message sequence number SeqNum and a variable gMReSend of a retransmission management structure body.
S6: and in the message receiving thread, receiving a response frame, extracting a frame sequence number in a protocol when the response message is received, inquiring whether the frame sequence number key value is in a storage space of the QCache data structure by using a traversal inquiry method in the QCache data structure, if the inquiry is successful, setting a retransmission flag in a structure variable as FALSE, and waiting for the key value pair to be removed from the QCache data structure in the traversal process.
S7: setting a retransmission processing timer, starting the timer, setting cycle time as RATES, traversing a key of a retransmission management structure variable by matching a frame number in a timer callback function (using traversal operation), judging whether a retransmission flag in gMReSend is FALSE or not in each traversed frame number in a gSndQ subscript index mode, and if the retransmission flag is FALSE, using a removal remove method in QCache to remove all contents corresponding to the sequence number from a queue. If TRUE, go to S6.
S8: and when the value is TIMES _ SET-1, the message needs to be retransmitted, and the data to be transmitted and the transmitted bus information are transmitted to a transmission function of a system bottom layer for transmission. While adding one to the number of transmissions in the retransmission structure variable.
S9: and in the process of triggering the timer, periodically performing the operation of the 6 th step, performing an operation of adding one to the transmission times of each retransmission structure, if the frame number is inquired to be matched in the retransmission process, ending the retransmission, and removing the key value pair from the gSndQ. Otherwise, the retransmission is carried out, when the retransmission TIMES reaches the preset TIMES TIMES _ SEND, the key value pair is removed from the gSndQ, which indicates that the retransmission TIMES reaches the maximum TIMES, and the overtime non-response is prompted.
The above description is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, several modifications and variations can be made without departing from the technical principle of the present invention, and these modifications and variations should also be regarded as the protection scope of the present invention.
Claims (10)
1. A message protocol timeout retransmission management method based on QCache is characterized by comprising the following steps:
s1: designing a message overtime retransmission protocol;
s2: defining a bus carrier BusInfo;
s3: defining a retransmission management structure MainReSend;
s4: defining a QCache variable gSndQ for storing the information sent out by the frame;
s5: at a message sending end, when the message content is filled and sent, judging whether the message needs to be retransmitted or not according to the response identifier, and when the message needs to be retransmitted, defining a retransmission management structure variable gMReSend and a SeqNum variable to record a message sequence number;
s6: in the message receiving thread, receiving the response frame and confirming the frame number, and searching the retransmission flag state in the retransmission management structure in the Qcache;
s7: traversing the Qcache frame number in the timer, and removing an element whether a retransmission flag in the message retransmission management structure body is negative;
s8: adding one to the counter in the retransmission management structure body in the timer, and performing retransmission operation when the residual value of the retransmission base number of the counter is that the retransmission base number is reduced by one;
s9: and when the retransmission times reach the preset times, removing the key value corresponding to the frame sequence number from the gSndQ.
2. The QCache-based message protocol retransmission timeout management method according to claim 1, wherein in step S1, when the message needs to be retransmitted overtime, the designed protocol has an acknowledgement feature, and after the message is sent out, the destination node replies to the reception acknowledgement frame after receiving the message.
3. The QCache-based messaging protocol timeout retransmission management method according to claim 2, wherein in step S1, the timeout retransmission protocol comprises an intersystem messaging protocol, the protocol is a variable length protocol, and comprises a two-byte protocol header FrmHead, a four-byte frame number FrmNum, and ID marking is performed using the frame number, the frame number is a unique identifier ID corresponding to a response frame, the identifier ID retransmission number recant of one byte, the frame length FrmLen of two bytes, the frame type FrmType of two bytes, the destination address FrmDst of four bytes, the source address FrmSrc of four bytes, and the response identifier FrmACKFlag of two bytes, and the identifier is used to indicate whether the frame needs to be responded, if the two bytes are 0xFF00, the frame needs to be responded, and if the two bytes are 0xFF00, the frame does not need to be responded; a two-byte function code FrmCode, payload contents FrmContent with an indefinite number of bytes, a two-byte check FrmChk, and a two-byte end-of-frame FrmTail.
4. The QCache-based message protocol timeout retransmission management method according to claim 3, characterized in that in step S1, an acknowledgement frame ACK is set, whose header part and trailer part are identical to the above message, and the sent frame is associated with the acknowledgement frame by frame sequence number when the frame protocols are associated with each other.
5. The QCache-based message protocol timeout retransmission management method according to claim 4, wherein in step S2, bus bearer BusInfo contains two elements in total: (1) the bus type is an enumeration type, 0 represents Ethernet transmission, 1 represents serial port transmission, and 2 represents CAN bus transmission; (2) the type of a destination address needing to send data is integer, and the destination address, the serial port number and the CAN bus port number are determined according to the bus type.
6. The QCache-based messaging protocol timeout resending management method according to claim 5, wherein in step S3, the structure MainReSend content comprises: (1) the bus carrier BusInfo defined in S2; (2) the memory address Addr of data to be sent is of an unsigned pointer type; (3) whether the retransmission flag IsReSnd is set to be of an unsigned character type, the retransmission is required when the value is 1, and the retransmission is not required when the value is 0; (4) a sent times count HaSnCnt set to unsigned integer indicating the number of times this data has been sent; (5) the number of retransmissions needed, nescnnt, this variable is set to unsigned short integer.
7. The QCache message protocol timeout retransmission management method according to claim 6, characterized in that in step S4, the type of key in QCache type variables gSndQ is set to integer, which is the frame number of the transmitted frame; the value is set to the type of the structure, which is the retransmission management structure MainReSend defined in S3.
8. The QCache-based message protocol timeout retransmission management method according to claim 7, wherein in step S5, at the message sending end, when the message content is filled and sent, it is determined whether the response identifier FrmACKFlag is 0xFF00, and if the determination fails, it indicates that the message does not need to be retransmitted according to the response; if the judgment is successful, defining a retransmission management structure variable gMReSend and a SeqNum variable recording message sequence number;
when the message content is filled, the bus carrier content in the variable gMReSend is filled according to the selected physical port type and the port address information, the head address gDataAddr of the data to be sent is assigned to the Addr content in the structure, whether the retransmission flag in the structure variable is SET to TURE, the number of TIMES HasnCnt that the data in the structure variable has been retransmitted is SET to 0, the number of TIMES NeSnCnt that the data in the structure variable needs to be retransmitted is SET to TIMES _ SET, the message sequence number SeqNum and the retransmission management structure variable gMReSend are subjected to insertion () in the QCache, and the message is sent out after the traversal query.
9. The QCache-based message protocol timeout retransmission management method according to claim 8, wherein in step S6, in the message receiving thread, the response frame is received, when the response message is received, the frame sequence number in the protocol is extracted, whether the frame sequence number key value is in the storage space of the QCache data structure is queried using the traversal query method in the QCache data structure, if the query is successful, whether the retransmission flag in the structure variable is set to FALSE, and the key value pair is removed from the QCache data structure in the process of waiting for traversal;
in step S7, a retransmission processing timer is set, the timer is started, the timer sets a period of time as rantes, in a timer callback function, a key of a retransmission management structure variable is traversed by matching a frame number, for each traversed frame number, whether a retransmission flag in gmrresend is FALSE is judged by using a gSndQ subscript index manner, and if the retransmission flag is FALSE, a removal remove method in QCache is used to remove all contents corresponding to the number from a queue; if TRUE, go to S6.
10. The QCache-based message protocol retransmission timeout management method according to claim 9, wherein in step S8, the gmrtesend counter in the retransmission management structure variable performs an add operation, the counter in the retransmission management structure variable performs a remainder operation on the tises _ SET, and when the value is tises _ SET-1, the message needs to be retransmitted, and the data to be transmitted and the transmitted bus information are transmitted to the transmission function of the system bottom layer for transmission; simultaneously adding one to the number of times of transmission in the variable of the retransmission structure;
in step S9, in the process of triggering the timer, periodically performing the operation of S6, adding one for each transmission frequency of the retransmission structure, if the frame number matching is found in the retransmission process, ending the retransmission, and removing the key value pair from the gSndQ; otherwise, the migration carries out retransmission operation, when the number of retransmission TIMES reaches the preset number of TIMES TIMES _ SEND, the key value pair is removed from the gSndQ, which indicates that the number of retransmission TIMES reaches the maximum number, and the overtime non-response is prompted.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211387223.9A CN115941128B (en) | 2022-11-07 | 2022-11-07 | QCache-based message protocol timeout retransmission management method |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211387223.9A CN115941128B (en) | 2022-11-07 | 2022-11-07 | QCache-based message protocol timeout retransmission management method |
Publications (2)
Publication Number | Publication Date |
---|---|
CN115941128A true CN115941128A (en) | 2023-04-07 |
CN115941128B CN115941128B (en) | 2024-09-20 |
Family
ID=86549758
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211387223.9A Active CN115941128B (en) | 2022-11-07 | 2022-11-07 | QCache-based message protocol timeout retransmission management method |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115941128B (en) |
Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4970714A (en) * | 1989-01-05 | 1990-11-13 | International Business Machines Corp. | Adaptive data link protocol |
CN1476181A (en) * | 2003-07-14 | 2004-02-18 | 中国科学院计算技术研究所 | Distribution type satellite network TLP performance acceleration protocol mode and method |
CN1479487A (en) * | 2003-07-22 | 2004-03-03 | 中国科学院计算技术研究所 | Method of ensuring track searching reliability in radio self organized network |
WO2017050216A1 (en) * | 2015-09-21 | 2017-03-30 | 华为技术有限公司 | Packet transmission method and user equipment |
CN109274783A (en) * | 2018-09-04 | 2019-01-25 | 北京华环电子股份有限公司 | A kind of implementation method of dhcp client multiplex roles |
CN113609518A (en) * | 2021-06-18 | 2021-11-05 | 天津津航计算技术研究所 | Message protocol overtime retransmission method and system based on associated container map |
CN113645008A (en) * | 2021-06-18 | 2021-11-12 | 天津津航计算技术研究所 | Message protocol overtime retransmission method and system based on linked list |
CN113765938A (en) * | 2021-09-24 | 2021-12-07 | 天津津航计算技术研究所 | Application layer protocol implementation method based on CAN2.0B protocol |
CN115941127A (en) * | 2022-11-07 | 2023-04-07 | 天津津航计算技术研究所 | Message protocol overtime retransmission management method based on hash table |
-
2022
- 2022-11-07 CN CN202211387223.9A patent/CN115941128B/en active Active
Patent Citations (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US4970714A (en) * | 1989-01-05 | 1990-11-13 | International Business Machines Corp. | Adaptive data link protocol |
CN1476181A (en) * | 2003-07-14 | 2004-02-18 | 中国科学院计算技术研究所 | Distribution type satellite network TLP performance acceleration protocol mode and method |
CN1479487A (en) * | 2003-07-22 | 2004-03-03 | 中国科学院计算技术研究所 | Method of ensuring track searching reliability in radio self organized network |
WO2017050216A1 (en) * | 2015-09-21 | 2017-03-30 | 华为技术有限公司 | Packet transmission method and user equipment |
CN109274783A (en) * | 2018-09-04 | 2019-01-25 | 北京华环电子股份有限公司 | A kind of implementation method of dhcp client multiplex roles |
CN113609518A (en) * | 2021-06-18 | 2021-11-05 | 天津津航计算技术研究所 | Message protocol overtime retransmission method and system based on associated container map |
CN113645008A (en) * | 2021-06-18 | 2021-11-12 | 天津津航计算技术研究所 | Message protocol overtime retransmission method and system based on linked list |
CN113765938A (en) * | 2021-09-24 | 2021-12-07 | 天津津航计算技术研究所 | Application layer protocol implementation method based on CAN2.0B protocol |
CN115941127A (en) * | 2022-11-07 | 2023-04-07 | 天津津航计算技术研究所 | Message protocol overtime retransmission management method based on hash table |
Non-Patent Citations (2)
Title |
---|
XIA LI: "CP performance in IEEE 802.11-based Ad Hoc networks with multiple wireless lossy links", 《IEEE TRANSACTIONS ON MOBILE COMPUTING》, 22 October 2007 (2007-10-22) * |
雷思磊 等: "基于北斗短报文的卫星通信车快速组网方案设计", 《全球定位系统》, vol. 18, no. 04, 31 August 2018 (2018-08-31) * |
Also Published As
Publication number | Publication date |
---|---|
CN115941128B (en) | 2024-09-20 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7487424B2 (en) | Bitmap manager, method of allocating a bitmap memory, method of generating an acknowledgement between network entities, and network entity implementing the same | |
CN100359839C (en) | Method for minimizing feedback responses in ARQ protocols | |
US8406227B2 (en) | Hybrid wired and wireless communication system and a communication method thereof | |
CN102377650A (en) | Data transmission processing method, device and system | |
CN101018206A (en) | Packet message processing method and device | |
US8312241B2 (en) | Serial buffer to support request packets with out of order response packets | |
CN113609518B (en) | Message protocol timeout retransmission method and system based on association container map | |
CN112165457A (en) | Method, system and device for file rearrangement and readable storage medium | |
CN111211990B (en) | Data packet processing method and device | |
CN114422289B (en) | Method and device for transmitting CAN message of electric automobile | |
CN115941127B (en) | Message protocol timeout retransmission management method based on hash table | |
CN115941128A (en) | Message protocol overtime retransmission management method based on QCache | |
US20100027566A1 (en) | Method for compressing a real-time transport protocol header extension field | |
CN104486247A (en) | Data transmission method and device based on serial server | |
WO2019223065A1 (en) | Data collection method, data sending method, data collection device, and network device | |
CN113238856A (en) | RDMA (remote direct memory Access) -based memory management method and device | |
CN112954068A (en) | RDMA (remote direct memory Access) -based data transmission method and device | |
CN113645008B (en) | Message protocol timeout retransmission method and system based on linked list | |
CN113067825B (en) | Method for multi-endpoint data backup based on SRV6 network protocol | |
KR100631742B1 (en) | AC frame transmission method and device | |
CN107786472B (en) | Efficient tcp session reorganization device | |
CN101989896B (en) | Feedback method and device for ARQ connection | |
US10051436B2 (en) | Compression with multicast dictionary | |
CN109802900B (en) | Message caching method, message reading method, message caching device, message reading device and computer readable storage medium | |
CN115174500B (en) | PISA-based transmitting node and switch for intra-network combined transmission |
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 |