CN113810384B - Message transmission method for realizing one-time characteristic - Google Patents

Message transmission method for realizing one-time characteristic Download PDF

Info

Publication number
CN113810384B
CN113810384B CN202110981958.3A CN202110981958A CN113810384B CN 113810384 B CN113810384 B CN 113810384B CN 202110981958 A CN202110981958 A CN 202110981958A CN 113810384 B CN113810384 B CN 113810384B
Authority
CN
China
Prior art keywords
message
version number
receiving end
sending
reply
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
CN202110981958.3A
Other languages
Chinese (zh)
Other versions
CN113810384A (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.)
Shanghai Trustkernel Information Technology Co ltd
Original Assignee
Shanghai Trustkernel Information 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 Shanghai Trustkernel Information Technology Co ltd filed Critical Shanghai Trustkernel Information Technology Co ltd
Priority to CN202110981958.3A priority Critical patent/CN113810384B/en
Publication of CN113810384A publication Critical patent/CN113810384A/en
Application granted granted Critical
Publication of CN113810384B publication Critical patent/CN113810384B/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
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/03Protocol definition or specification 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0006Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format
    • 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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Quality & Reliability (AREA)
  • Computer Security & Cryptography (AREA)
  • Communication Control (AREA)

Abstract

The invention provides a message transmission method for realizing one-time characteristics, which comprises two stages of message sending and message receiving reply, wherein the message sending stage comprises a message sending end and a message receiving end, and the message sending end in the message sending stage comprises the following steps: step S1: the upper layer transmits in the message to be transmitted; step S2: reading a version number; step S3: storing the message content to be sent; step S4: packaging the stored message content and the version number and sending the packaged message content and the version number to a message receiving end; and sets a timeout counter. The invention can ensure the characteristic of just once at the protocol layer, so that the application or service logic constructed on the method does not need to consider the problem of packet loss or repeated transmission possibly occurring in the information transmission process.

Description

Message transmission method for realizing one-time characteristic
Technical Field
The invention relates to the technical field of network transmission, in particular to a message transmission method for realizing primary characteristics.
Background
The process of network transmission is generally considered to be uncertain due to transmission media, hardware and software problems during transmission. To cope with the impact of such problems, the protocols at different levels of hardware and software all need to process the received data packets or data streams in various ways, for example, the transmission control protocol (Transmission Control Protocol, abbreviated as TCP) adopts techniques such as sliding window automatic retransmission to process the possible phenomena of packet loss and disorder in network transmission.
However, after the protocol takes relevant measures, the application layer still cannot assume that the application layer itself operates in an ideal network environment, and in an extreme case, because of the retransmission mechanism of the application layer or the protocol layer, the same data packet may be received multiple times by the far end, which may cause errors in some service logics, such as repeated deductions caused by retransmitting a deducted data packet multiple times.
The patent document with publication number CN106789427a discloses a network transmission amount calculating method, which comprises four steps, a first step of adjusting packet loss rate by adjusting transmission rate, a second step of constructing an estimation model of network bandwidth, a third step of adjusting transmitted frame rate, sampling data packets transmitted by a network, and a fourth step of correcting errors in the transmission process.
The upper layer application can adjust the related service and realize the related service as an idempotent service so as to avoid the problem. But this adjustment may require a significant amount of effort in some cases or be difficult to implement business logic. Therefore, a technical solution is needed to improve the above technical problems.
Disclosure of Invention
In view of the drawbacks of the prior art, an object of the present invention is to provide a message transmission method that implements a one-time feature.
The invention provides a message transmission method for realizing one-time characteristics, which comprises two stages of message sending and reply receiving, wherein the message sending stage comprises a message sending end and a message receiving end, and the message sending end in the message sending stage comprises the following steps:
step S1: the upper layer transmits in the message to be transmitted;
step S2: reading a version number;
step S3: storing the message content to be sent;
step S4: packaging the stored message content and the version number and sending the packaged message content and the version number to a message receiving end; and sets a timeout counter.
Preferably, the step S2 includes the steps of:
step S2.1: if the version number is odd, directly jumping to the step S3;
step S2.2: if the version number is even, the version number is incremented by 1 and the version number is saved.
Preferably, the packing means binds the version number with the message content using a method.
Preferably, the message receiving end in the message sending message stage comprises the following steps:
step 1: if the reply of the message receiving end is not received after the timeout counter times out, the message sending stage is initiated again;
step 2: if the message is received before the timeout counter times out, the version number in the message is checked, and corresponding logic is performed according to the value of the version number in the message and the value of the version number of the receiving end.
Preferably, the step 2 includes the steps of:
step 2.1: if the difference between the version number and the version number of the message receiving end is smaller than 0, indicating that the error is only generated in the second stage last time, ignoring the message and returning success;
step 2.2: if the version number of the message is greater than the version number of the receiving end by 1, the sending end sends a new message, at the moment, the receiving end executes related service according to the message, the version number of the receiving end is increased by 1 and stored, the received message content and the execution result of the service are stored, and success is returned to the message sending end;
step 2.3: if the version number of the message is equal to that of the receiving end, the sending end is informed to repeat the step of sending the message once; checking whether the message content is consistent with the message content stored before the receiving end, if not, indicating that the states of the two ends generate unexpected problems, reporting errors and ending; otherwise, returning success to the message sending end.
Preferably, the receiving reply stage includes a message sending end and a message receiving end, and the message sending end of the receiving reply stage includes the following steps:
step A: reading the version number, if the version number is even, indicating that the message sending stage is not executed, reporting errors and exiting;
and (B) step (B): and sending the version number to a message receiving end, and setting a timeout counter.
Preferably, the message sending end further comprises the following steps:
step one: if the reply of the message receiving end is not received after the timeout counter is overtime, a receiving reply stage is initiated again;
step two: if the reply of the message receiving end is received before the timeout counter times out, comparing the version number of the content of the message receiving end with the version number of the message receiving end;
step three: if the version number in the reply is 1 larger than the version number of the message receiving end, the reply content corresponds to the previous message sending request, and the service related content in the reply content is the reply of one-time complete message transmission;
step four: under other conditions, reporting errors;
step five: increasing the version number of the message sending end by 1 and storing;
step six: and returning the business content in the received data to the upper layer.
Preferably, the message receiving end of the receiving reply stage includes the following steps:
step a: receiving the message, checking the version number in the message, and performing corresponding logic according to the value of the version number in the message and the value of the version number of the receiving end;
step b: if the version number is equal to the version number of the message receiving end, the receiving reply request corresponds to the last message sending request; at this time, the version number of the message receiving end is added with 1 and stored, and the added version number and the result of service execution output stored in the message sending stage are packaged and sent back to the message sending end;
step c: if the version number of the message is smaller than the version number of the receiving end by 1, the message sending end sends a receiving reply request once, but the return content of the message receiving end to the request is not processed correctly, and the request for receiving the reply is resent; at this time, the version number of the current message receiving end and the result of service execution output stored in the message sending stage are packaged and sent back to the message sending end;
step d: otherwise, reporting errors and returning.
Preferably, the method provides the user with an abstraction of the message transmission exactly once; a feature of just one message service at a time, means that the system ensures that each message is sent and validated only once.
Preferably, the method maintains a version number at both the sender and receiver of the message. Compared with the prior art, the invention has the following beneficial effects:
the invention can ensure the characteristic of just once at the protocol layer, so that the application or service logic constructed on the method does not need to consider the problem of packet loss or repeated transmission possibly occurring in the information transmission process.
Drawings
Other features, objects and advantages of the present invention will become more apparent upon reading of the detailed description of non-limiting embodiments, given with reference to the accompanying drawings in which:
fig. 1 is a flow schematic of the present invention.
Detailed Description
The present invention will be described in detail with reference to specific examples. The following examples will assist those skilled in the art in further understanding the present invention, but are not intended to limit the invention in any way. It should be noted that variations and modifications could be made by those skilled in the art without departing from the inventive concept. These are all within the scope of the present invention.
The invention provides a message transmission method for realizing one-time characteristics, which can provide a message transmission abstraction for exactly one time for a scheme user. Exact once is a feature of a message service that indicates that the system ensures that each message is sent and validated only once.
To achieve this feature, the scheme maintains a version number at both the sender and receiver of the message. This scheme requires that the change of version number is durable and not rollback, i.e. after the version number is modified, the read version number will be the written value until the next modification of the version number. In the initial state, the version numbers of the sending end and the receiving end of the message are both 0.
The invention divides one message transmission into two phases: respectively sending a message and receiving a reply.
In the message sending stage, the message sending end performs the following steps:
step S1: the upper layer passes in the message to be sent. After the message sending entity receives the incoming message, the message transmission starts.
Step S2: reading the version number, storing the version number in a memory, and directly reading; step S2.1: if the version number is odd, directly jumping to the step S3; step S2.2: if the version number is even, the version number is incremented by 1 and saved, and in this embodiment, the memory may be a flash.
Step S3: storing the message content to be sent, and storing the message content in a storage device in an overlaying manner; step S4: packaging the stored message content and the version number and sending the packaged message content and the version number to a message receiving end; setting a timeout counter in an entity at the device end, wherein the storage device in the embodiment may be a flash; the entity may be a process or a thread.
Packaging generally refers to the use of methods to ensure binding of version numbers to message content, such as signing the entire packet using an asymmetric key algorithm, but the specific packaging scheme is not within the definition of the scheme.
The message receiving end executes the following steps:
step 1: if no reply has been received from the message receiver after the timeout counter has timed out, the send message phase is initiated again.
Step 2: if the message is received before the timeout counter times out, checking the version number in the message, and performing corresponding logic according to the value of the version number in the message and the value of the version number of the receiving end; step 2.1: if the difference between the version number and the version number of the message receiving end is smaller than 0, the error is caused only in the second stage last time, the message is ignored and success is returned, and the equipment end continues to the second stage; step 2.2: if the version number of the message is greater than the version number of the receiving end by 1, the sending end sends a new message, at the moment, the receiving end can execute related service according to the message, increment the version number of the receiving end by 1, then store the received message content and the execution result of the service, and return success to the message sending end; step 2.3: if the version number of the message is equal to that of the receiving end, the sending end is informed to repeat the step of sending the message once. At this time, checking whether the message content is consistent with the message content stored at the receiving end, if not, indicating that the states of the two ends generate unexpected problems, reporting errors and ending; otherwise, returning success to the message sending end.
In the receiving reply stage, the message sending end executes the following steps:
step A: reading the version number, if the version number is even, indicating that the message sending stage is not executed, reporting errors and exiting; and (B) step (B): the version number is sent to the message receiving end and then a timeout counter is set.
The message receiving end executes the following steps:
step a: receiving the message, checking the version number in the message, and performing corresponding logic according to the value of the version number in the message and the value of the version number of the receiving end; step b: if the version number is equal to the version number of the message receiving end, the received reply request corresponds to the last message sending request. At this time, the version number of the message receiving end is added with 1 and stored, and the added version number and the result of service execution output stored in the message sending stage are packaged and sent back to the message sending end; step c: if the version number of the message is smaller than the version number of the receiving end by 1, it is indicated that the message sending end has sent a request for receiving a reply, but the return content of the message receiving end to the request is not processed correctly, so that the request for receiving the reply is resent. At this time, the version number of the current message receiving end and the result of service execution output stored in the message sending stage are packaged and sent back to the message sending end; step d: otherwise, reporting errors and returning.
The message sending end executes the following steps:
step one: if the reply of the message receiving end is not received after the timeout counter times out, initiating a receiving reply stage again; step two: if a reply of the message receiving end is received before the timeout counter times out, comparing the version number of the content of the message receiving end with the version number of the message receiving end; step three: if the version number in the reply is 1 larger than the version number of the message receiving end, the reply content corresponds to the previous message sending request, and then the service related content in the reply content is a reply of one complete message transmission; step four: under other conditions, reporting errors; step five: the version number of the message sending end is increased by 1; step six: and returning the business content in the received data to the upper layer.
Those skilled in the art will appreciate that the invention provides a system and its individual devices, modules, units, etc. that can be implemented entirely by logic programming of method steps, in addition to being implemented as pure computer readable program code, in the form of logic gates, switches, application specific integrated circuits, programmable logic controllers, embedded microcontrollers, etc. Therefore, the system and various devices, modules and units thereof provided by the invention can be regarded as a hardware component, and the devices, modules and units for realizing various functions included in the system can also be regarded as structures in the hardware component; means, modules, and units for implementing the various functions may also be considered as either software modules for implementing the methods or structures within hardware components.
The foregoing describes specific embodiments of the present invention. It is to be understood that the invention is not limited to the particular embodiments described above, and that various changes or modifications may be made by those skilled in the art within the scope of the appended claims without affecting the spirit of the invention. The embodiments of the present application and features in the embodiments may be combined with each other arbitrarily without conflict.

Claims (4)

1. A message transmission method for realizing primary characteristics, the method comprising two stages of message sending and reply receiving, wherein the message sending stage comprises a message sending end and a message receiving end, and the message sending end in the message sending stage comprises the following steps:
step S1: the upper layer transmits in the message to be transmitted;
step S2: reading a version number;
step S3: storing the message content to be sent;
step S4: packaging the stored message content and the version number and sending the packaged message content and the version number to a message receiving end; setting a timeout counter;
the step S2 includes the steps of:
step S2.1: if the version number is odd, directly jumping to the step S3;
step S2.2: if the version number is even, the version number is increased by 1 and the version number is saved;
the message receiving and sending end in the message sending stage comprises the following steps:
step 1: if the reply of the message receiving end is not received after the timeout counter times out, the message sending stage is initiated again;
the message receiving end in the message sending message stage comprises the following steps:
step 2: if the message is received before the timeout counter times out, checking the version number in the message, and performing corresponding logic according to the value of the version number in the message and the value of the version number of the receiving end;
the step 2 comprises the following steps:
step 2.1: if the difference between the version number and the version number of the message receiving end is smaller than 0, indicating that the error is only generated in the second stage last time, ignoring the message and returning success;
step 2.2: if the version number of the message is greater than the version number of the receiving end by 1, the sending end sends a new message, at the moment, the receiving end executes related service according to the message, the version number of the receiving end is increased by 1 and stored, the received message content and the execution result of the service are stored, and success is returned to the message sending end;
step 2.3: if the version number of the message is equal to that of the receiving end, the sending end is informed to repeat the step of sending the message once; checking whether the message content is consistent with the message content stored before the receiving end, if not, indicating that the states of the two ends generate unexpected problems, reporting errors and ending; otherwise, returning success to the message sending end;
the receiving reply stage comprises a message sending end and a message receiving end, and the message sending end of the receiving reply stage comprises the following steps:
step A: reading the version number, if the version number is even, indicating that the message sending stage is not executed, reporting errors and exiting;
and (B) step (B): the version number is sent to a message receiving end, and a timeout counter is set;
the message sending end further comprises the following steps:
step one: if the reply of the message receiving end is not received after the timeout counter is overtime, a receiving reply stage is initiated again;
step two: if the reply of the message receiving end is received before the timeout counter times out, comparing the version number of the content of the message receiving end with the version number of the message receiving end;
step three: if the version number in the reply is 1 larger than the version number of the message receiving end, the reply content corresponds to the previous message sending request, and the service related content in the reply content is the reply of one-time complete message transmission;
step four: under other conditions, reporting errors;
step five: increasing the version number of the message sending end by 1 and storing;
step six: returning the business content in the received data to the upper layer;
the message receiving end of the receiving reply stage comprises the following steps:
step a: receiving the message, checking the version number in the message, and performing corresponding logic according to the value of the version number in the message and the value of the version number of the receiving end;
step b: if the version number is equal to the version number of the message receiving end, the receiving reply request corresponds to the last message sending request; at this time, the version number of the message receiving end is added with 1 and stored, and the added version number and the result of service execution output stored in the message sending stage are packaged and sent back to the message sending end;
step c: if the version number of the message is smaller than the version number of the receiving end by 1, the message sending end sends a receiving reply request once, but the return content of the message receiving end to the request is not processed correctly, and the request for receiving the reply is resent; at this time, the version number of the current message receiving end and the result of service execution output stored in the message sending stage are packaged and sent back to the message sending end;
step d: otherwise, reporting errors and returning.
2. The message transmission method for implementing a one-time feature of claim 1, wherein the packing finger use method binds the version number with the message content.
3. A message transmission method implementing a one-time feature as claimed in claim 1, wherein the method provides a message transmission abstraction to the user just once; a feature of just one message service at a time, means that the system ensures that each message is sent and validated only once.
4. The message transmission method for implementing one-time characteristics according to claim 1, wherein said method maintains a version number at both a transmitting end and a receiving end of a message.
CN202110981958.3A 2021-08-25 2021-08-25 Message transmission method for realizing one-time characteristic Active CN113810384B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110981958.3A CN113810384B (en) 2021-08-25 2021-08-25 Message transmission method for realizing one-time characteristic

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110981958.3A CN113810384B (en) 2021-08-25 2021-08-25 Message transmission method for realizing one-time characteristic

Publications (2)

Publication Number Publication Date
CN113810384A CN113810384A (en) 2021-12-17
CN113810384B true CN113810384B (en) 2023-06-20

Family

ID=78894068

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110981958.3A Active CN113810384B (en) 2021-08-25 2021-08-25 Message transmission method for realizing one-time characteristic

Country Status (1)

Country Link
CN (1) CN113810384B (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6615383B1 (en) * 1998-05-29 2003-09-02 Sun Microsystems, Inc. System and method for message transmission between network nodes connected by parallel links
CN101645871A (en) * 2008-08-04 2010-02-10 大唐移动通信设备有限公司 Method, system and device for transmitting GIP message
CN103378936A (en) * 2012-04-28 2013-10-30 中兴通讯股份有限公司 Data transmission method and device
CN103647747A (en) * 2013-11-08 2014-03-19 陈明 Data communication system between multiple intelligent terminal devices and server

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP4037058B2 (en) * 1999-01-13 2008-01-23 富士通株式会社 Electronic information exclusive control apparatus, exclusive control method, and computer-readable recording medium recording exclusive control program
CN1956421A (en) * 2005-10-26 2007-05-02 北京航空航天大学 Reliable transmission method for web service message
CN102571635A (en) * 2012-01-18 2012-07-11 浪潮(北京)电子信息产业有限公司 Message transmission method and equipment
CN110008037A (en) * 2019-02-28 2019-07-12 北京达佳互联信息技术有限公司 Message treatment method, device and storage medium
CN112448898A (en) * 2019-08-28 2021-03-05 无锡江南计算技术研究所 Message order-preserving method based on sequence number mechanism

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6615383B1 (en) * 1998-05-29 2003-09-02 Sun Microsystems, Inc. System and method for message transmission between network nodes connected by parallel links
CN101645871A (en) * 2008-08-04 2010-02-10 大唐移动通信设备有限公司 Method, system and device for transmitting GIP message
CN103378936A (en) * 2012-04-28 2013-10-30 中兴通讯股份有限公司 Data transmission method and device
CN103647747A (en) * 2013-11-08 2014-03-19 陈明 Data communication system between multiple intelligent terminal devices and server

Also Published As

Publication number Publication date
CN113810384A (en) 2021-12-17

Similar Documents

Publication Publication Date Title
US7864078B2 (en) Method and device for decoding a signal
CN109981480A (en) A kind of data transmission method and the first equipment
US7707335B2 (en) Device and method for managing a retransmit operation
Chkliaev et al. Verification and improvement of the sliding window protocol
US8102776B2 (en) Methods and apparatus for generating simulated network traffic
US20070018708A1 (en) Method and apparatus for determining optimal delay time and computer-readable storage medium storing optimal delay time determining program
CN101645766A (en) Method, device and system for realizing data packet retransmission
WO2019090745A1 (en) Method for determining harq number, network device, terminal and computer storage medium
CN109067513A (en) A kind of half-duplex operation method, apparatus and system
US20190109796A1 (en) Method and device for dynamically managing the message retransmission delay on an interconnection network
CN113810384B (en) Message transmission method for realizing one-time characteristic
CN111404872A (en) Message processing method, device and system
CN113645008B (en) Message protocol timeout retransmission method and system based on linked list
CN113794539B (en) Bidirectional communication control method and device
Wang et al. Performance modelling and analysis of unreliable links with retransmissions using network calculus
CN114337938A (en) Data transmission method, data retransmission method, device and related equipment
JP6295609B2 (en) Reception device, communication system, and program
CN102843224B (en) The merging method and device of HARQ
CN116909624B (en) Bitmap data processing method, random access memory, electronic device, and storage medium
CN116737281B (en) File uploading method, device and storage medium
CN114237973A (en) Serial communication bus data verification method and system
Zhigulin et al. Detecting faults in TFTP implementations using Finite State Machines with timeouts
WO2010103607A1 (en) Data transfer device and data transfer device control method
Hercog et al. The Importance of Sliding Window Protocol Generalisation in a Communication Protocols Course
Rodriguez-Navas et al. Harmonizing dependability and real time in CAN networks

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