CN105450365A - Message-sending device and method, message-receiving device and method, and message interaction system - Google Patents
Message-sending device and method, message-receiving device and method, and message interaction system Download PDFInfo
- Publication number
- CN105450365A CN105450365A CN201410413075.2A CN201410413075A CN105450365A CN 105450365 A CN105450365 A CN 105450365A CN 201410413075 A CN201410413075 A CN 201410413075A CN 105450365 A CN105450365 A CN 105450365A
- Authority
- CN
- China
- Prior art keywords
- sending
- message
- transmission
- numbers
- receiving device
- 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
Links
- 230000003993 interaction Effects 0.000 title claims abstract description 37
- 238000000034 method Methods 0.000 title claims abstract description 29
- 230000005540 biological transmission Effects 0.000 claims abstract description 306
- 238000010586 diagram Methods 0.000 description 6
- 239000000284 extract Substances 0.000 description 4
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000008569 process Effects 0.000 description 2
- 238000004891 communication Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Landscapes
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
本发明提出了一种消息发送装置,包括:统计单元,统计发送至同一个消息接收装置的多个发送消息;编号分配单元,按照预设编号分配顺序和所述多个发送消息的发送顺序,为所述多个发送消息中的每个发送消息分配对应的发送编号;交互单元,按照所述多个发送消息的发送顺序,将所述每个发送消息和与所述每个发送消息对应的发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述预设编号分配顺序和接收到的发送消息对应的发送编号确定未接收到的发送消息。相应地,本发明还提供了一种消息接收装置和消息接收方法和消息发送方法。通过该技术方案,可以传输的安全性和可靠性。
The present invention proposes a message sending device, including: a statistical unit, which counts multiple sent messages sent to the same message receiving device; a number allocation unit, according to the preset number allocation order and the sending order of the multiple sent messages, Assigning a corresponding sending number to each sending message in the plurality of sending messages; the interaction unit, according to the sending order of the plurality of sending messages, associates each sending message with the corresponding sending message The sending number is sent to the message receiving device for the message receiving device to determine the unreceived sending message according to the preset number assignment sequence and the sending number corresponding to the received sending message. Correspondingly, the present invention also provides a message receiving device, a message receiving method, and a message sending method. Through this technical solution, the security and reliability of transmission can be achieved.
Description
技术领域technical field
本发明涉及数据交互技术领域,具体而言,涉及一种消息发送装置、一种消息接收装置、一种消息发送方法、一种消息接收方法及消息交互系统。The present invention relates to the technical field of data interaction, in particular to a message sending device, a message receiving device, a message sending method, a message receiving method and a message interaction system.
背景技术Background technique
目前很多消息传输的链路都是不可靠的,不可靠的原因分两种:一种是物理链路不可靠,有可能出现一些不稳定因素导致消息丢失,一种是采用的协议不是可靠传输的协议,也有可能导致消息丢失。At present, many links for message transmission are unreliable. There are two reasons for unreliability: one is that the physical link is unreliable, and some unstable factors may cause message loss; the other is that the protocol used is not reliable. protocol, it may also result in message loss.
因此,需要一种新的技术方案,可以在不可靠的链路下使消息可以进行可靠传输,从而确保传输的安全性和可靠性。Therefore, a new technical solution is needed, which can enable reliable transmission of messages under unreliable links, thereby ensuring the security and reliability of transmission.
发明内容Contents of the invention
本发明正是基于上述问题,提出了一种新的技术方案,可以在不可靠的链路下使消息可以进行可靠传输,从而确保传输的安全性和可靠性。Based on the above problems, the present invention proposes a new technical solution, which can enable reliable transmission of messages under unreliable links, thereby ensuring the safety and reliability of transmission.
有鉴于此,本发明提出了一种消息发送装置,包括:统计单元,统计发送至同一个消息接收装置的多个发送消息;编号分配单元,连接至所述统计单元,按照预设编号分配顺序和所述多个发送消息的发送顺序,为所述多个发送消息中的每个发送消息分配对应的发送编号,其中,所述每个发送消息具有唯一的发送编号,且所述每个发送消息对应的发送编号与相邻的发送消息对应的发送编号连续;交互单元,连接至所述编号分配单元,按照所述多个发送消息的发送顺序,将所述每个发送消息和与所述每个发送消息对应的发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述预设编号分配顺序和接收到的发送消息对应的发送编号确定未接收到的发送消息。In view of this, the present invention proposes a message sending device, including: a statistics unit, which counts a plurality of messages sent to the same message receiving device; a number allocation unit, connected to the statistics unit, according to the preset number allocation sequence and the sending order of the plurality of sending messages, assigning a corresponding sending number to each sending message in the plurality of sending messages, wherein each sending message has a unique sending number, and each sending message The sending number corresponding to the message is continuous with the sending number corresponding to the adjacent sending message; the interaction unit is connected to the number allocation unit, and according to the sending order of the multiple sending messages, sums each sending message with the The sending number corresponding to each sending message is sent to the message receiving device for the message receiving device to determine the unreceived sending message according to the preset number assignment sequence and the sending number corresponding to the received sending message.
在该技术方案中,根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, a sending number is assigned to each sending message according to the preset numbering sequence and the sending order of each sending message among multiple sending messages sent to the same message receiving device, and each sending number is unique, and Multiple transmission numbers are continuous, for example, assign numbers from 1 to 10 for 10 transmission messages sent to a message receiving device, so that the unreceived messages can be determined according to the sequence of numbers and the numbers of the received transmission messages. Send a message, such as receiving a message numbered 1, 2, 3, 6, then it can be determined that the number 4 and 5 between the number 3 and the number 6 has not been received, so that the message receiving device sends a new message to The message sending device requests to send messages numbered 4 and 5, so as to realize reliable transmission of unreliable links and ensure data transmission safety.
其中,编号连续是指编号之间有前后连续的关系,能判断大小,并且能够通过任一两个编号得出两者中间的编号。Among them, the serial number means that there is a continuous relationship between the numbers, the size can be judged, and the number in the middle can be obtained from any two numbers.
在上述技术方案中,优选地,还包括:存储单元,连接至所述编号分配单元,将所述多个发送消息中的每个发送消息和与所述每个发送消息对应的发送编号进行关联存储。In the above technical solution, preferably, further comprising: a storage unit, connected to the number allocating unit, associating each of the plurality of sending messages with the sending number corresponding to each sending message storage.
在该技术方案中,可以将每个发送消息和与其对应的发送编号进行关联存储,从而方便根据消息接收装置发送的发送编号为其确定对应的发送消息,并再次向消息接收装置发送该消息。In this technical solution, each sending message can be stored in association with its corresponding sending number, so that it is convenient to determine the corresponding sending message for it according to the sending number sent by the message receiving device, and send the message to the message receiving device again.
在上述技术方案中,优选地,所述交互单元还用于:在接收到所述消息接收装置发送的任一发送编号时,从所述存储单元存储的所有发送编号中,查找出与所述任一发送编号匹配的目标发送编号,并获取与所述目标发送编号相关联的目标发送消息,并将所述目标发送编号和所述目标发送消息发送至所述消息接收装置。In the above technical solution, preferably, the interaction unit is further configured to: when receiving any transmission number sent by the message receiving device, from all the transmission numbers stored in the storage unit, find out the A target transmission number matched by any transmission number, obtaining a target transmission message associated with the target transmission number, and sending the target transmission number and the target transmission message to the message receiving device.
在该技术方案中,在消息发送装置接收到消息接收装置发送的发送编号时,从存储的信息中查找出该编号对应的发送消息,继而重新将该发送消息发送给消息接收装置,保证消息接收装置可以接收到消息发送装置发送的所有消息。In this technical solution, when the message sending device receives the sending number sent by the message receiving device, it finds out the sending message corresponding to the number from the stored information, and then resends the sending message to the message receiving device to ensure message reception. The device can receive all messages sent by the message sending device.
在上述技术方案中,优选地,所述交互单元还用于:接收所述消息接收装置发送的最新发送编号查询请求,以及根据所述最新发送编号查询请求,查询所述消息发送装置最新发送至所述消息接收装置的最新发送编号,并将所述最新发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述最新发送编号确定是否存在未接收到的发送消息。In the above technical solution, preferably, the interaction unit is further configured to: receive the latest transmission number query request sent by the message receiving device, and query the latest transmission number sent by the message sending device according to the latest transmission number query request The latest sending number of the message receiving device, and send the latest sending number to the message receiving device, so that the message receiving device can determine whether there is an unreceived sending message according to the latest sending number.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,所述发送编号的类型包括数字编号和/或字母编号。In the above technical solution, preferably, the type of the transmission number includes a number number and/or a letter number.
在该技术方案中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, the transmission numbers include but are not limited to digital numbers and letter numbers, wherein each transmission number is a continuous number, and the continuous number refers to a combination of codes with a continuous relationship before and after, which can determine the size, and can pass through any two codes. The number can get the number in the middle of the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
根据本发明的另一方面,还提供了一种消息接收装置,包括:交互单元,接收所述消息发送装置发送的多个发送消息和与所述多个发送消息中每个发送消息对应的发送编号;确定单元,连接至所述交互单元,根据预设编号分配顺序和接收到的发送编号的接收顺序,确定所述消息接收装置未接收到的发送消息。According to another aspect of the present invention, there is also provided a message receiving device, including: an interaction unit, receiving a plurality of sending messages sent by the message sending device and a sending message corresponding to each sending message in the plurality of sending messages A number; a determining unit connected to the interaction unit, and determining the sending messages not received by the message receiving device according to the preset number assignment sequence and the receiving sequence of the received sending numbers.
在该技术方案中,消息发送装置根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,消息接收装置根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, the message sending device assigns a sending number to each sending message according to the preset numbering sequence and the sending order of each sending message among the multiple sending messages sent to the same message receiving device, and each sending number Unique, and multiple sending numbers are continuous, for example, assign numbers from 1 to 10 to 10 sending messages sent to a message receiving device, so that the message receiving device according to the numbering sequence and the number of the received sending message, It can be determined that the sent messages that have not been received, such as receiving the sent messages numbered 1, 2, 3, and 6, then it can be determined that the sent messages numbered 4 and 5 between the number 3 and the number 6 have not been received, so that The message receiving device requests the message sending device to send messages numbered 4 and 5 again, so as to realize reliable transmission of unreliable links and ensure data transmission security.
在上述技术方案中,优选地,所述交互单元还用于:将接收到的多个发送消息发送至所述消息接收队列中;所述消息接收装置还包括:判断单元,连接至所述交互单元,按照预设时间间隔判断所述消息接收队列中是否存在发送消息;获取单元,连接至所述判断单元,在判断结果为所述消息接收队列中存在所述发送消息时,获取所述消息发送队列中的当前队首发送消息;比较单元,连接至所述获取单元,根据所述预设编号分配顺序将所述当前队首发送消息对应的第一发送编号与上一次解析的发送消息对应的第二发送消息编号进行比较;以及所述确定单元具体用于:根据所述第一发送消息和所述第二发送消息的比较结果确定所述第一发送编号与所述第二发送编号之间是否存在未接收到的其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, the interaction unit is further configured to: send the received multiple sending messages to the message receiving queue; the message receiving device further includes: a judging unit connected to the interaction A unit that judges whether there is a sending message in the message receiving queue according to a preset time interval; an acquiring unit that is connected to the judging unit, and acquires the message when the judgment result is that the sending message exists in the message receiving queue The current team leader in the sending queue sends a message; the comparison unit is connected to the acquisition unit, and according to the preset number allocation sequence, the first sending number corresponding to the current team leader sending message corresponds to the last parsed sending message and the determining unit is specifically configured to: determine the difference between the first sending number and the second sending number according to the comparison result of the first sending message and the second sending message Whether there are other transmission numbers that have not been received in between, to determine whether there are any transmission messages that have not been received.
在该技术方案,消息接收装置将接收到的发送消息放入消息接收队列中,并从消息接收队列中提取发送消息进行解析,在上一次解析完成时,则从队首获取发送消息进行解析,在获取到发送消息时,将该发送消息的发送编号与上一次解析的发送消息的发送编号进行比较,进而判断两者是否是相邻的,如果两者相邻,则说明不存在未接收到的消息,如果两者不相邻,则说明中间有未接收到的消息。In this technical solution, the message receiving device puts the received sending message into the message receiving queue, and extracts the sending message from the message receiving queue for analysis, and when the last analysis is completed, obtains the sending message from the head of the queue for analysis, When the sending message is obtained, compare the sending number of the sending message with the sending number of the last parsed sending message, and then judge whether the two are adjacent. If the two are adjacent, it means that there is no unreceived If the two are not adjacent, it means that there is an unreceived message in the middle.
在上述技术方案中,优选地,所述交互单元还用于:在判断结果为所述接收队列中不存在所述发送消息时,向所述消息发送装置发送最新发送编号查询请求;所述比较单元还用于:在接收到所述消息发送装置发送的最新发送编号时,根据所述预设编号分配顺序将所述最新发送编号与所述当前队首发送消息的所述第一发送编号进行比较;所述确定单元还用于:根据所述第一发送编号和所述最新发送编号的比较结果确定所述最新发送编号和所述第一发送编号之间是否存在未接收到的所述其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, the interaction unit is further configured to: when it is judged that the sending message does not exist in the receiving queue, send the latest sending number query request to the message sending device; the comparison The unit is further configured to: when receiving the latest sending number sent by the message sending device, compare the latest sending number with the first sending number of the message sent by the current team leader according to the preset number allocation sequence comparison; the determining unit is further configured to: determine whether there is the other unreceived transmission number between the latest transmission number and the first transmission number according to the comparison result of the first transmission number and the latest transmission number Send number to determine if there are unreceived send messages.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,所述交互单元还用于:在所述第一发送编号和所述第二发送编号之间存在所述其他发送编号时,将所述其他发送编号发送至所述消息发送装置,以供所述消息发送装置查找并发送所述其他发送编号对应的发送消息至所述消息接收装置,以及接收所述消息发送装置发送的所述其他发送编号对应的发送消息。In the above technical solution, preferably, the interaction unit is further configured to: when there is the other sending number between the first sending number and the second sending number, send the other sending number to the The message sending device, for the message sending device to find and send the sending message corresponding to the other sending number to the message receiving device, and receive the sending message corresponding to the other sending number sent by the message sending device.
在该技术方案中,消息接收装置可以将未接收到的发送信号发给消息发送装置,在消息发送装置接收到消息接收装置发送的发送编号时,从存储的信息中查找出该编号对应的发送消息,继而重新将该发送消息发送给消息接收装置,保证消息接收装置可以接收到消息发送装置发送的所有消息。In this technical solution, the message receiving device can send the unreceived sending signal to the message sending device, and when the message sending device receives the sending number sent by the message receiving device, it can find out the sending number corresponding to the number from the stored information. message, and then resend the sending message to the message receiving device to ensure that the message receiving device can receive all the messages sent by the message sending device.
在上述技术方案中,优选地,所述确定单元具体用于:在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之前时,将所述第一发送编号对应的发送消息舍弃,并确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序相邻时,确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序不相邻时,确定所述第一发送编号与所述第二发送编号之间存在未接收到的其他发送编号,并根据所述第一发送编号的编号分配顺序和所述第二发送编号的编号分配顺序确定未接收到的其他发送编号;以及在所述第一发送编号与所述最新发送编号一致时,确定不存在未接收到的发送消息;在所述第一发送编号与所述最新发送编号不一致时,确定存在未接收到的发送消息,并根据所述第一发送编号的编号分配顺序和所述最新发送编号的编号分配顺序确定未接收到的其他发送编号。In the above technical solution, preferably, the determining unit is specifically configured to: when the number allocation order of the first transmission number is before that of the second transmission number, associate the first transmission number with The sending message is discarded, and it is determined that there are no other sending numbers that have not been received between the first sending number and the second sending number; the number allocation sequence of the first sending number is located in the second sending number After the number allocation order of the first transmission number and the number allocation order of the second transmission number are adjacent, it is determined that there is no unreceived number between the first transmission number and the second transmission number Other transmission numbers; when the number allocation sequence of the first transmission number is after the number allocation sequence of the second transmission number, and the number allocation sequence of the first transmission number and the second transmission number are not adjacent , determining that there are other transmission numbers that have not been received between the first transmission number and the second transmission number, and determining according to the number allocation sequence of the first transmission number and the number allocation sequence of the second transmission number Other transmission numbers that have not been received; and when the first transmission number is consistent with the latest transmission number, it is determined that there is no unreceived transmission message; when the first transmission number is inconsistent with the latest transmission number , determining that there are unreceived sending messages, and determining other unreceived sending numbers according to the number assignment sequence of the first sending number and the number assignment sequence of the latest sending number.
在该技术方案中,具体地,可以根据发送编号的是否相邻或一致,或者其前后顺序确定两个发送编号之间是否存在其他编号。其中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, specifically, it may be determined whether there are other numbers between two sending numbers according to whether the sending numbers are adjacent or consistent, or their sequence. Among them, the transmission number includes but is not limited to a number number and a letter number. Among them, each transmission number is a continuous number, and a continuous number refers to a combination of codes with a continuous relationship between the front and back, which can determine the size, and can be obtained by any two numbers. number between the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
根据本发明的又一方面,还提供了一种消息发送方法,包括:统计发送至同一个消息接收装置的多个发送消息;按照预设编号分配顺序和所述多个发送消息的发送顺序,为所述多个发送消息中的每个发送消息分配对应的发送编号,其中,所述每个发送消息具有唯一的发送编号,且所述每个发送消息对应的发送编号与相邻的发送消息对应的发送编号连续;按照所述多个发送消息的发送顺序,将所述每个发送消息和与所述每个发送消息对应的发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述预设编号分配顺序和接收到的发送消息对应的发送编号确定未接收到的发送消息。According to still another aspect of the present invention, there is also provided a message sending method, including: counting multiple sending messages sent to the same message receiving device; Assigning a corresponding sending number to each sending message in the plurality of sending messages, wherein each sending message has a unique sending number, and the sending number corresponding to each sending message is the same as that of adjacent sending messages The corresponding sending numbers are continuous; according to the sending order of the multiple sending messages, sending each sending message and the sending number corresponding to each sending message to the message receiving device for receiving the message The device determines the unreceived sending message according to the preset number assignment sequence and the sending number corresponding to the received sending message.
在该技术方案中,根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, a sending number is assigned to each sending message according to the preset numbering sequence and the sending order of each sending message among multiple sending messages sent to the same message receiving device, and each sending number is unique, and Multiple transmission numbers are continuous, for example, assign numbers from 1 to 10 for 10 transmission messages sent to a message receiving device, so that the unreceived messages can be determined according to the sequence of numbers and the numbers of the received transmission messages. Send a message, such as receiving a message numbered 1, 2, 3, 6, then it can be determined that the number 4 and 5 between the number 3 and the number 6 has not been received, so that the message receiving device sends a new message to The message sending device requests to send messages numbered 4 and 5, so as to realize reliable transmission of unreliable links and ensure data transmission security.
其中,编号连续是指编号之间有前后连续的关系,能判断大小,并且能够通过任一两个编号得出两者中间的编号。Among them, the serial number means that there is a continuous relationship between the numbers, the size can be judged, and the number in the middle can be obtained from any two numbers.
在上述技术方案中,优选地,还包括:将所述多个发送消息中的每个发送消息和与所述每个发送消息对应的发送编号进行关联存储。In the above technical solution, preferably, further comprising: associating and storing each of the multiple sending messages and a sending number corresponding to each sending message.
在该技术方案中,可以将每个发送消息和与其对应的发送编号进行关联存储,从而方便根据消息接收装置发送的发送编号为其确定对应的发送消息,并再次向消息接收装置发送该消息。In this technical solution, each sending message can be stored in association with its corresponding sending number, so that it is convenient to determine the corresponding sending message for it according to the sending number sent by the message receiving device, and send the message to the message receiving device again.
在上述技术方案中,优选地,还包括:在接收到所述消息接收装置发送的任一发送编号时,从存储的所有发送编号中,查找出与所述任一发送编号匹配的目标发送编号,并获取与所述目标发送编号相关联的目标发送消息,并将所述目标发送编号和所述目标发送消息发送至所述消息接收装置。In the above technical solution, preferably, it further includes: when receiving any sending number sent by the message receiving device, searching for the target sending number matching the any sending number from all the stored sending numbers , and acquire a target sending message associated with the target sending number, and send the target sending number and the target sending message to the message receiving device.
在该技术方案中,在消息发送装置接收到消息接收装置发送的发送编号时,从存储的信息中查找出该编号对应的发送消息,继而重新将该发送消息发送给消息接收装置,保证消息接收装置可以接收到消息发送装置发送的所有消息。In this technical solution, when the message sending device receives the sending number sent by the message receiving device, it finds out the sending message corresponding to the number from the stored information, and then resends the sending message to the message receiving device to ensure message reception. The device can receive all messages sent by the message sending device.
在上述技术方案中,优选地,还包括:接收所述消息接收装置发送的最新发送编号查询请求;以及根据所述最新发送编号查询请求,查询所述消息发送装置最新发送至所述消息接收装置的最新发送编号,并将所述最新发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述最新发送编号确定是否存在未接收到的发送消息。In the above technical solution, preferably, it also includes: receiving the latest sending number query request sent by the message receiving device; and querying the latest sending number sent by the message sending device to the message receiving device according to the latest sending number query request and send the latest sending number to the message receiving device, so that the message receiving device can determine whether there is an unreceived sending message according to the latest sending number.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,所述发送编号的类型包括数字编号和/或字母编号。In the above technical solution, preferably, the type of the transmission number includes a number number and/or a letter number.
在该技术方案中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, the transmission numbers include but are not limited to digital numbers and letter numbers, wherein each transmission number is a continuous number, and the continuous number refers to a combination of codes with a continuous relationship before and after, which can determine the size, and can pass through any two codes. The number can get the number in the middle of the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
根据本发明的再一方面,还提供了一种消息接收方法,包括:接收所述消息发送装置发送的多个发送消息和与所述多个发送消息中每个发送消息对应的发送编号;根据预设编号分配顺序和接收到的发送编号的接收顺序,确定所述消息接收装置未接收到的发送消息。According to still another aspect of the present invention, there is also provided a message receiving method, including: receiving a plurality of sending messages sent by the message sending device and a sending number corresponding to each sending message in the plurality of sending messages; according to The preset number allocation sequence and the receiving sequence of the received sending numbers determine the sending messages not received by the message receiving device.
在该技术方案中,消息发送装置根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,消息接收装置根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, the message sending device assigns a sending number to each sending message according to the preset numbering sequence and the sending order of each sending message among the multiple sending messages sent to the same message receiving device, and each sending number Unique, and multiple sending numbers are continuous, for example, assign numbers from 1 to 10 to 10 sending messages sent to a message receiving device, so that the message receiving device according to the numbering sequence and the number of the received sending message, It can be determined that the sent messages that have not been received, such as receiving the sent messages numbered 1, 2, 3, and 6, then it can be determined that the sent messages numbered 4 and 5 between the number 3 and the number 6 have not been received, so that The message receiving device requests the message sending device to send messages numbered 4 and 5 again, so as to realize reliable transmission of unreliable links and ensure data transmission security.
在上述技术方案中,优选地,还包括:将接收到的多个发送消息发送至所述消息接收队列中;按照预设时间间隔判断所述消息接收队列中是否存在发送消息;在判断结果为所述消息接收队列中存在所述发送消息时,获取所述消息发送队列中的当前队首发送消息;根据所述预设编号分配顺序将所述当前队首发送消息对应的第一发送编号与上一次解析的发送消息对应的第二发送消息编号进行比较;以及根据所述第一发送消息和所述第二发送消息的比较结果确定所述第一发送编号与所述第二发送编号之间是否存在未接收到的其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, it also includes: sending the received multiple sending messages to the message receiving queue; judging whether there is a sending message in the message receiving queue according to a preset time interval; when the judgment result is When there is the sending message in the message receiving queue, obtain the current team head sending message in the message sending queue; according to the preset number allocation sequence, the first sending number corresponding to the current team leader sending message and comparing the second sent message number corresponding to the last parsed sent message; and determining the difference between the first sent number and the second sent message according to the comparison result between the first sent message and the second sent message Whether there are other send numbers that have not been received to determine if there are send messages that have not been received.
在该技术方案中,消息发送装置根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,消息接收装置根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, the message sending device assigns a sending number to each sending message according to the preset numbering sequence and the sending order of each sending message among the multiple sending messages sent to the same message receiving device, and each sending number Unique, and multiple sending numbers are continuous, for example, assign numbers from 1 to 10 to 10 sending messages sent to a message receiving device, so that the message receiving device according to the numbering sequence and the number of the received sending message, It can be determined that the sent messages that have not been received, such as receiving the sent messages numbered 1, 2, 3, and 6, then it can be determined that the sent messages numbered 4 and 5 between the number 3 and the number 6 have not been received, so that The message receiving device requests the message sending device to send messages numbered 4 and 5 again, so as to realize reliable transmission of unreliable links and ensure data transmission security.
在上述技术方案中,优选地,还包括:在判断结果为所述接收队列中不存在所述发送消息时,向所述消息发送装置发送最新发送编号查询请求;在接收到所述消息发送装置发送的最新发送编号时,根据所述预设编号分配顺序将所述最新发送编号与所述当前队首发送消息的所述第一发送编号进行比较;根据所述第一发送编号和所述最新发送编号的比较结果确定所述最新发送编号和所述第一发送编号之间是否存在未接收到的所述其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, it further includes: when the result of the judgment is that the sending message does not exist in the receiving queue, sending the latest sending number query request to the message sending device; When sending the latest sending number, compare the latest sending number with the first sending number of the current team head sending message according to the preset number allocation order; according to the first sending number and the latest The comparison result of the transmission number determines whether there is the other transmission number that has not been received between the latest transmission number and the first transmission number, so as to determine whether there is an unreceived transmission message.
在该技术方案,消息接收装置将接收到的发送消息放入消息接收队列中,并从消息接收队列中提取发送消息进行解析,在上一次解析完成时,则从队首获取发送消息进行解析,在获取到发送消息时,将该发送消息的发送编号与上一次解析的发送消息的发送编号进行比较,进而判断两者是否是相邻的,如果两者相邻,则说明不存在未接收到的消息,如果两者不相邻,则说明中间有未接收到的消息。In this technical solution, the message receiving device puts the received sending message into the message receiving queue, and extracts the sending message from the message receiving queue for analysis, and when the last analysis is completed, obtains the sending message from the head of the queue for analysis, When the sending message is obtained, compare the sending number of the sending message with the sending number of the last parsed sending message, and then judge whether the two are adjacent. If the two are adjacent, it means that there is no unreceived If the two are not adjacent, it means that there is an unreceived message in the middle.
在上述技术方案中,优选地,还包括:在所述第一发送编号和所述第二发送编号之间存在所述其他发送编号时,将所述其他发送编号发送至所述消息发送装置,以供所述消息发送装置查找并发送所述其他发送编号对应的发送消息至所述消息接收装置,以及接收所述消息发送装置发送的所述其他发送编号对应的发送消息。In the above technical solution, preferably, further comprising: when there is the other sending number between the first sending number and the second sending number, sending the other sending number to the message sending device, For the message sending device to find and send the sending message corresponding to the other sending number to the message receiving device, and receive the sending message corresponding to the other sending number sent by the message sending device.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,根据所述第一发送消息和所述第二发送消息的比较结果确定所述第一发送编号与所述第二发送编号之间是否存在未接收到的其他发送编号,具体包括:在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之前时,将所述第一发送编号对应的发送消息舍弃,并确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序相邻时,确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序不相邻时,确定所述第一发送编号与所述第二发送编号之间存在未接收到的其他发送编号,并根据所述第一发送编号的编号分配顺序和所述第二发送编号的编号分配顺序确定未接收到的其他发送编号;以及所述根据所述第一发送编号和所述最新发送编号的比较结果确定所述最新发送编号和所述第一发送编号之间是否存在未接收到的所述其他发送编号,具体包括:在所述第一发送编号与所述最新发送编号一致时,确定不存在未接收到的发送消息;在所述第一发送编号与所述最新发送编号不一致时,确定存在未接收到的发送消息,并根据所述第一发送编号的编号分配顺序和所述最新发送编号的编号分配顺序确定未接收到的其他发送编号。In the above technical solution, preferably, it is determined whether there are other unreceived transmissions between the first transmission number and the second transmission number according to the comparison result of the first transmission message and the second transmission message numbering, specifically including: discarding the sending message corresponding to the first sending number when the number allocation sequence of the first sending number is before that of the second sending number, and determining the first sending number There is no other unreceived transmission number between the number and the second transmission number; the number allocation sequence of the first transmission number is after the number allocation sequence of the second transmission number, and the first transmission number When the number is adjacent to the number allocation sequence of the second transmission number, it is determined that there is no other transmission number that has not been received between the first transmission number and the second transmission number; When the number allocation sequence is after the number allocation sequence of the second transmission number, and the number allocation sequence of the first transmission number is not adjacent to the second transmission number, determine that the first transmission number and the second transmission number are not adjacent to each other. There are other transmission numbers that have not been received between the two transmission numbers, and the other transmission numbers that have not been received are determined according to the number allocation sequence of the first transmission number and the number allocation sequence of the second transmission number; and The comparison result of the first transmission number and the latest transmission number determines whether there are other transmission numbers that have not been received between the latest transmission number and the first transmission number, specifically including: When the sending number is consistent with the latest sending number, it is determined that there is no unreceived sending message; when the first sending number is inconsistent with the latest sending number, it is determined that there is an unreceived sending message, and according to the The number allocation sequence of the first transmission number and the number allocation sequence of the latest transmission number determine other transmission numbers that have not been received.
在该技术方案中,具体地,可以根据发送编号的是否相邻或一致,或者其前后顺序确定两个发送编号之间是否存在其他编号。其中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, specifically, it may be determined whether there are other numbers between two sending numbers according to whether the sending numbers are adjacent or consistent, or their sequence. Among them, the transmission number includes but is not limited to a number number and a letter number. Among them, each transmission number is a continuous number, and a continuous number refers to a combination of codes with a continuous relationship between the front and back, which can determine the size, and can be obtained by any two numbers. number between the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
根据本发明的再一方面,还提供了一种消息交互系统,包括上述技术方案中任一项所述的消息接收装置和消息发送装置。该消息交互系统具有与消息接收装置和消息发送装置相同的技术效果,在此不再赘述。According to still another aspect of the present invention, there is also provided a message interaction system, including the message receiving device and the message sending device described in any one of the above technical solutions. The message interaction system has the same technical effect as that of the message receiving device and the message sending device, which will not be repeated here.
通过以上技术方案,可以在不可靠的链路下使消息可以进行可靠传输,从而确保传输的安全性和可靠性。Through the above technical solutions, messages can be transmitted reliably under unreliable links, thereby ensuring the security and reliability of transmission.
附图说明Description of drawings
图1示出了根据本发明的实施例的消息发送装置的框图;Fig. 1 shows a block diagram of a message sending device according to an embodiment of the present invention;
图2示出了根据本发明的实施例的消息接收装置的框图;Fig. 2 shows a block diagram of a message receiving device according to an embodiment of the present invention;
图3示出了根据本发明的实施例的消息发送方法的流程图;Fig. 3 shows a flow chart of a method for sending a message according to an embodiment of the present invention;
图4示出了根据本发明的实施例的消息接收方法的流程图;Fig. 4 shows the flowchart of the method for receiving a message according to an embodiment of the present invention;
图5示出了根据本发明的实施例的数据交互系统的框图;Figure 5 shows a block diagram of a data interaction system according to an embodiment of the present invention;
图6示出了根据本发明的实施例的消息发送的流程图;FIG. 6 shows a flowchart of message sending according to an embodiment of the present invention;
图7示出了根据本发明的实施例的消息接收的流程图;Figure 7 shows a flow chart of message reception according to an embodiment of the present invention;
图8示出了根据本发明的实施例的消息接收方法的具体流程图。Fig. 8 shows a specific flow chart of a message receiving method according to an embodiment of the present invention.
具体实施方式detailed description
为了能够更清楚地理解本发明的上述目的、特征和优点,下面结合附图和具体实施方式对本发明进行进一步的详细描述。需要说明的是,在不冲突的情况下,本申请的实施例及实施例中的特征可以相互组合。In order to understand the above-mentioned purpose, features and advantages of the present invention more clearly, the present invention will be further described in detail below in conjunction with the accompanying drawings and specific embodiments. It should be noted that, in the case of no conflict, the embodiments of the present application and the features in the embodiments can be combined with each other.
在下面的描述中阐述了很多具体细节以便于充分理解本发明,但是,本发明还可以采用其他不同于在此描述的其他方式来实施,因此,本发明的保护范围并不受下面公开的具体实施例的限制。In the following description, many specific details are set forth in order to fully understand the present invention. However, the present invention can also be implemented in other ways different from those described here. Therefore, the protection scope of the present invention is not limited by the specific details disclosed below. EXAMPLE LIMITATIONS.
图1示出了根据本发明的实施例的消息发送装置的框图。Fig. 1 shows a block diagram of a message sending device according to an embodiment of the present invention.
如图1所示,根据本发明的实施例的消息发送装置100,包括:统计单元102,统计发送至同一个消息接收装置的多个发送消息;编号分配单元104,连接至所述统计单元102,按照预设编号分配顺序和所述多个发送消息的发送顺序,为所述多个发送消息中的每个发送消息分配对应的发送编号,其中,所述每个发送消息具有唯一的发送编号,且所述每个发送消息对应的发送编号与相邻的发送消息对应的发送编号连续;交互单元106,连接至所述编号分配单元104,按照所述多个发送消息的发送顺序,将所述每个发送消息和与所述每个发送消息对应的发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述预设编号分配顺序和接收到的发送消息对应的发送编号确定未接收到的发送消息。As shown in Figure 1, the message sending device 100 according to the embodiment of the present invention includes: a statistics unit 102, which counts a plurality of sending messages sent to the same message receiving device; a serial number allocation unit 104, connected to the statistics unit 102 , assigning a corresponding sending number to each sending message in the plurality of sending messages according to the preset number assignment sequence and the sending order of the plurality of sending messages, wherein each sending message has a unique sending number , and the sending number corresponding to each sent message is continuous with the sending number corresponding to the adjacent sending message; the interaction unit 106 is connected to the number assignment unit 104, and assigns the sent messages according to the sending order of the multiple sent messages Each sending message and the sending number corresponding to each sending message are sent to the message receiving device, so that the message receiving device assigns the sending number corresponding to the received sending message according to the preset number assignment sequence Identify sent messages that were not received.
在该技术方案中,根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, a sending number is assigned to each sending message according to the preset numbering sequence and the sending order of each sending message among multiple sending messages sent to the same message receiving device, and each sending number is unique, and Multiple transmission numbers are continuous, for example, assign numbers from 1 to 10 for 10 transmission messages sent to a message receiving device, so that the unreceived messages can be determined according to the sequence of numbers and the numbers of the received transmission messages. Send a message, such as receiving a message numbered 1, 2, 3, 6, then it can be determined that the number 4 and 5 between the number 3 and the number 6 has not been received, so that the message receiving device sends a new message to The message sending device requests to send messages numbered 4 and 5, so as to realize reliable transmission of unreliable links and ensure data transmission security.
其中,编号连续是指编号之间有前后连续的关系,能判断大小,并且能够通过任一两个编号得出两者中间的编号。Among them, the serial number means that there is a continuous relationship between the numbers, the size can be judged, and the number in the middle can be obtained from any two numbers.
在上述技术方案中,优选地,还包括:存储单元108,连接至所述编号分配单元104,将所述多个发送消息中的每个发送消息和与所述每个发送消息对应的发送编号进行关联存储。In the above technical solution, preferably, it also includes: a storage unit 108, connected to the number allocation unit 104, and storing each sending message in the plurality of sending messages and the sending number corresponding to each sending message for associative storage.
在该技术方案中,可以将每个发送消息和与其对应的发送编号进行关联存储,从而方便根据消息接收装置发送的发送编号为其确定对应的发送消息,并再次向消息接收装置发送该消息。In this technical solution, each sending message can be stored in association with its corresponding sending number, so that it is convenient to determine the corresponding sending message for it according to the sending number sent by the message receiving device, and send the message to the message receiving device again.
在上述技术方案中,优选地,所述交互单元106还用于:在接收到所述消息接收装置发送的任一发送编号时,从所述存储单元108存储的所有发送编号中,查找出与所述任一发送编号匹配的目标发送编号,并获取与所述目标发送编号相关联的目标发送消息,并将所述目标发送编号和所述目标发送消息发送至所述消息接收装置。In the above technical solution, preferably, the interaction unit 106 is further configured to: when receiving any transmission number sent by the message receiving device, from all the transmission numbers stored in the storage unit 108, find out the The target transmission number matched by any transmission number, and the target transmission message associated with the target transmission number is obtained, and the target transmission number and the target transmission message are sent to the message receiving device.
在该技术方案中,在消息发送装置接收到消息接收装置发送的发送编号时,从存储的信息中查找出该编号对应的发送消息,继而重新将该发送消息发送给消息接收装置,保证消息接收装置可以接收到消息发送装置发送的所有消息。In this technical solution, when the message sending device receives the sending number sent by the message receiving device, it finds out the sending message corresponding to the number from the stored information, and then resends the sending message to the message receiving device to ensure message reception. The device can receive all messages sent by the message sending device.
在上述技术方案中,优选地,所述交互单元104还用于:接收所述消息接收装置发送的最新发送编号查询请求,以及根据所述最新发送编号查询请求,查询所述消息发送装置最新发送至所述消息接收装置的最新发送编号,并将所述最新发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述最新发送编号确定是否存在未接收到的发送消息。In the above technical solution, preferably, the interaction unit 104 is further configured to: receive the latest transmission number query request sent by the message receiving device, and query the latest transmission number query request of the message sending device according to the latest transmission number query request. to the latest sending number of the message receiving device, and sending the latest sending number to the message receiving device, so that the message receiving device can determine whether there is an unreceived sending message according to the latest sending number.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,所述发送编号的类型包括数字编号和/或字母编号。In the above technical solution, preferably, the type of the transmission number includes a number number and/or a letter number.
在该技术方案中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, the transmission numbers include but are not limited to digital numbers and letter numbers, wherein each transmission number is a continuous number, and the continuous number refers to a combination of codes with a continuous relationship before and after, which can determine the size, and can pass through any two codes. The number can get the number in the middle of the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
图2示出了根据本发明的实施例的消息接收装置的框图。Fig. 2 shows a block diagram of a message receiving device according to an embodiment of the present invention.
如图2所示,根据本发明的实施例的消息接收装置200,包括:交互单元202,接收所述消息发送装置发送的多个发送消息和与所述多个发送消息中每个发送消息对应的发送编号;确定单元204,连接至所述交互单元202,根据预设编号分配顺序和接收到的发送编号的接收顺序,确定所述消息接收装置未接收到的发送消息。As shown in FIG. 2, the message receiving device 200 according to the embodiment of the present invention includes: an interaction unit 202, which receives a plurality of sending messages sent by the message sending device and corresponds to each sending message in the plurality of sending messages The determining unit 204 is connected to the interaction unit 202, and determines the sending message not received by the message receiving device according to the preset number assignment sequence and the receiving sequence of the received sending numbers.
在该技术方案中,消息发送装置根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,消息接收装置根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, the message sending device assigns a sending number to each sending message according to the preset numbering sequence and the sending order of each sending message among the multiple sending messages sent to the same message receiving device, and each sending number Unique, and multiple sending numbers are continuous, for example, assign numbers from 1 to 10 to 10 sending messages sent to a message receiving device, so that the message receiving device according to the numbering sequence and the number of the received sending message, It can be determined that the sent messages that have not been received, such as receiving the sent messages numbered 1, 2, 3, and 6, then it can be determined that the sent messages numbered 4 and 5 between the number 3 and the number 6 have not been received, so that The message receiving device requests the message sending device to send messages numbered 4 and 5 again, so as to realize reliable transmission of unreliable links and ensure data transmission security.
在上述技术方案中,优选地,所述交互单元202还用于:将接收到的多个发送消息发送至所述消息接收队列中;所述消息接收装置200还包括:判断单元206,连接至所述交互单元202,按照预设时间间隔判断所述消息接收队列中是否存在发送消息;获取单元208,连接至所述判断单元206,在判断结果为所述消息接收队列中存在所述发送消息时,获取所述消息发送队列中的当前队首发送消息;比较单元210,连接至所述获取单元208,根据所述预设编号分配顺序将所述当前队首发送消息对应的第一发送编号与上一次解析的发送消息对应的第二发送消息编号进行比较;以及所述确定单元204具体用于:根据所述第一发送消息和所述第二发送消息的比较结果确定所述第一发送编号与所述第二发送编号之间是否存在未接收到的其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, the interaction unit 202 is further configured to: send the received multiple sending messages to the message receiving queue; the message receiving device 200 also includes: a judging unit 206 connected to The interaction unit 202 judges whether there is a sending message in the message receiving queue according to a preset time interval; the obtaining unit 208 is connected to the judging unit 206, and the judgment result is that the sending message exists in the message receiving queue , obtain the message sent by the current team leader in the message sending queue; the comparison unit 210 is connected to the acquisition unit 208, and assigns the first sending number corresponding to the message sent by the current team leader according to the preset number allocation order comparing with the second sent message number corresponding to the last parsed sent message; and the determining unit 204 is specifically configured to: determine the first sent message according to the comparison result of the first sent message and the second sent message Whether there are other unreceived sending numbers between the number and the second sending number, so as to determine whether there are unreceived sending messages.
在该技术方案,消息接收装置将接收到的发送消息放入消息接收队列中,并从消息接收队列中提取发送消息进行解析,在上一次解析完成时,则从队首获取发送消息进行解析,在获取到发送消息时,将该发送消息的发送编号与上一次解析的发送消息的发送编号进行比较,进而判断两者是否是相邻的,如果两者相邻,则说明不存在未接收到的消息,如果两者不相邻,则说明中间有未接收到的消息。In this technical solution, the message receiving device puts the received sending message into the message receiving queue, and extracts the sending message from the message receiving queue for analysis, and when the last analysis is completed, obtains the sending message from the head of the queue for analysis, When the sending message is obtained, compare the sending number of the sending message with the sending number of the last parsed sending message, and then judge whether the two are adjacent. If the two are adjacent, it means that there is no unreceived If the two are not adjacent, it means that there is an unreceived message in the middle.
在上述技术方案中,优选地,所述交互单元202还用于:在判断结果为所述接收队列中不存在所述发送消息时,向所述消息发送装置发送最新发送编号查询请求;所述比较单元210还用于:在接收到所述消息发送装置发送的最新发送编号时,根据所述预设编号分配顺序将所述最新发送编号与所述当前队首发送消息的所述第一发送编号进行比较;所述确定单元204还用于:根据所述第一发送编号和所述最新发送编号的比较结果确定所述最新发送编号和所述第一发送编号之间是否存在未接收到的所述其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, the interaction unit 202 is further configured to: when the result of the judgment is that the sending message does not exist in the receiving queue, send the latest sending number query request to the message sending device; The comparison unit 210 is further configured to: when receiving the latest transmission number sent by the message sending device, compare the latest transmission number with the first transmission number of the message sent by the current team leader according to the preset number allocation sequence. The determination unit 204 is further configured to: determine whether there is an unreceived transmission number between the latest transmission number and the first transmission number according to the comparison result of the first transmission number and the latest transmission number The other send numbers to determine whether there are unreceived send messages.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,所述交互单元202还用于:在所述第一发送编号和所述第二发送编号之间存在所述其他发送编号时,将所述其他发送编号发送至所述消息发送装置,以供所述消息发送装置查找并发送所述其他发送编号对应的发送消息至所述消息接收装置,以及接收所述消息发送装置发送的所述其他发送编号对应的发送消息。In the above technical solution, preferably, the interaction unit 202 is further configured to: when there is the other sending number between the first sending number and the second sending number, send the other sending number to The message sending device, for the message sending device to search for and send the sending message corresponding to the other sending number to the message receiving device, and receive the sending message corresponding to the other sending number sent by the message sending device .
在该技术方案中,消息接收装置可以将未接收到的发送信号发给消息发送装置,在消息发送装置接收到消息接收装置发送的发送编号时,从存储的信息中查找出该编号对应的发送消息,继而重新将该发送消息发送给消息接收装置,保证消息接收装置可以接收到消息发送装置发送的所有消息。In this technical solution, the message receiving device can send the unreceived sending signal to the message sending device, and when the message sending device receives the sending number sent by the message receiving device, it can find out the sending number corresponding to the number from the stored information. message, and then resend the sending message to the message receiving device to ensure that the message receiving device can receive all the messages sent by the message sending device.
在上述技术方案中,优选地,所述确定单元204具体用于:在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之前时,将所述第一发送编号对应的发送消息舍弃,并确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序相邻时,确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序不相邻时,确定所述第一发送编号与所述第二发送编号之间存在未接收到的其他发送编号,并根据所述第一发送编号的编号分配顺序和所述第二发送编号的编号分配顺序确定未接收到的其他发送编号;以及在所述第一发送编号与所述最新发送编号一致时,确定不存在未接收到的发送消息;在所述第一发送编号与所述最新发送编号不一致时,确定存在未接收到的发送消息,并根据所述第一发送编号的编号分配顺序和所述最新发送编号的编号分配顺序确定未接收到的其他发送编号。In the above technical solution, preferably, the determining unit 204 is specifically configured to: when the number allocation sequence of the first transmission number is before the number allocation sequence of the second transmission number, assign the first transmission number to The corresponding sending message is discarded, and it is determined that there is no other sending number that has not been received between the first sending number and the second sending number; the number allocation sequence of the first sending number is located in the second sending number After the number allocation order of the numbers, and when the number allocation order of the first transmission number and the second transmission number are adjacent, it is determined that there is no unreceived communication between the first transmission number and the second transmission number. other transmission numbers; the number allocation sequence of the first transmission number is after the number allocation sequence of the second transmission number, and the number allocation sequence of the first transmission number is not adjacent to the number allocation sequence of the second transmission number , determine that there are other transmission numbers that have not been received between the first transmission number and the second transmission number, and according to the number allocation sequence of the first transmission number and the number allocation sequence of the second transmission number Determining other sending numbers that have not been received; and when the first sending number is consistent with the latest sending number, determining that there is no unreceived sending message; when the first sending number is inconsistent with the latest sending number , determine that there are unreceived sending messages, and determine other unreceived sending numbers according to the number assignment sequence of the first sending number and the number assignment sequence of the latest sending number.
在该技术方案中,具体地,可以根据发送编号的是否相邻或一致,或者其前后顺序确定两个发送编号之间是否存在其他编号。其中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, specifically, it may be determined whether there are other numbers between two sending numbers according to whether the sending numbers are adjacent or consistent, or their sequence. Among them, the transmission number includes but is not limited to a number number and a letter number. Among them, each transmission number is a continuous number, and a continuous number refers to a combination of codes with a continuous relationship between the front and back, which can determine the size, and can be obtained by any two numbers. number between the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
图3示出了根据本发明的实施例的消息发送方法的流程图。Fig. 3 shows a flowchart of a message sending method according to an embodiment of the present invention.
如图3所示,根据本发明的实施例的消息发送方法,包括:步骤302,统计发送至同一个消息接收装置的多个发送消息;步骤304,按照预设编号分配顺序和所述多个发送消息的发送顺序,为所述多个发送消息中的每个发送消息分配对应的发送编号,其中,所述每个发送消息具有唯一的发送编号,且所述每个发送消息对应的发送编号与相邻的发送消息对应的发送编号连续;步骤306,按照所述多个发送消息的发送顺序,将所述每个发送消息和与所述每个发送消息对应的发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述预设编号分配顺序和接收到的发送消息对应的发送编号确定未接收到的发送消息。As shown in Figure 3, the message sending method according to the embodiment of the present invention includes: step 302, counting multiple sending messages sent to the same message receiving device; The sending order of sending messages, assigning a corresponding sending number to each sending message in the plurality of sending messages, wherein each sending message has a unique sending number, and the sending number corresponding to each sending message The sending numbers corresponding to adjacent sending messages are continuous; step 306, according to the sending order of the multiple sending messages, sending each sending message and the sending number corresponding to each sending message to the message The receiving device is used for the message receiving device to determine the unreceived sending message according to the preset number assignment sequence and the sending number corresponding to the received sending message.
在该技术方案中,根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, a sending number is assigned to each sending message according to the preset numbering sequence and the sending order of each sending message among multiple sending messages sent to the same message receiving device, and each sending number is unique, and Multiple transmission numbers are continuous, for example, assign numbers from 1 to 10 for 10 transmission messages sent to a message receiving device, so that the unreceived messages can be determined according to the sequence of numbers and the numbers of the received transmission messages. Send a message, such as receiving a message numbered 1, 2, 3, 6, then it can be determined that the number 4 and 5 between the number 3 and the number 6 has not been received, so that the message receiving device sends a new message to The message sending device requests to send messages numbered 4 and 5, so as to realize reliable transmission of unreliable links and ensure data transmission security.
其中,编号连续是指编号之间有前后连续的关系,能判断大小,并且能够通过任一两个编号得出两者中间的编号。Among them, the serial number means that there is a continuous relationship between the numbers, the size can be judged, and the number in the middle can be obtained from any two numbers.
在上述技术方案中,优选地,还包括:将所述多个发送消息中的每个发送消息和与所述每个发送消息对应的发送编号进行关联存储。In the above technical solution, preferably, further comprising: associating and storing each of the multiple sending messages and a sending number corresponding to each sending message.
在该技术方案中,可以将每个发送消息和与其对应的发送编号进行关联存储,从而方便根据消息接收装置发送的发送编号为其确定对应的发送消息,并再次向消息接收装置发送该消息。In this technical solution, each sending message can be stored in association with its corresponding sending number, so that it is convenient to determine the corresponding sending message for it according to the sending number sent by the message receiving device, and send the message to the message receiving device again.
在上述技术方案中,优选地,还包括:在接收到所述消息接收装置发送的任一发送编号时,从存储的所有发送编号中,查找出与所述任一发送编号匹配的目标发送编号,并获取与所述目标发送编号相关联的目标发送消息,并将所述目标发送编号和所述目标发送消息发送至所述消息接收装置。In the above technical solution, preferably, it further includes: when receiving any sending number sent by the message receiving device, searching for the target sending number matching the any sending number from all the stored sending numbers , and acquire a target sending message associated with the target sending number, and send the target sending number and the target sending message to the message receiving device.
在该技术方案中,在消息发送装置接收到消息接收装置发送的发送编号时,从存储的信息中查找出该编号对应的发送消息,继而重新将该发送消息发送给消息接收装置,保证消息接收装置可以接收到消息发送装置发送的所有消息。In this technical solution, when the message sending device receives the sending number sent by the message receiving device, it finds out the sending message corresponding to the number from the stored information, and then resends the sending message to the message receiving device to ensure message reception. The device can receive all messages sent by the message sending device.
在上述技术方案中,优选地,还包括:接收所述消息接收装置发送的最新发送编号查询请求;以及根据所述最新发送编号查询请求,查询所述消息发送装置最新发送至所述消息接收装置的最新发送编号,并将所述最新发送编号发送至所述消息接收装置,以供所述消息接收装置根据所述最新发送编号确定是否存在未接收到的发送消息。In the above technical solution, preferably, it also includes: receiving the latest sending number query request sent by the message receiving device; and querying the latest sending number sent by the message sending device to the message receiving device according to the latest sending number query request and send the latest sending number to the message receiving device, so that the message receiving device can determine whether there is an unreceived sending message according to the latest sending number.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,所述发送编号的类型包括数字编号和/或字母编号。In the above technical solution, preferably, the type of the transmission number includes a number number and/or a letter number.
在该技术方案中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, the transmission numbers include but are not limited to digital numbers and letter numbers, wherein each transmission number is a continuous number, and the continuous number refers to a combination of codes with a continuous relationship before and after, which can determine the size, and can pass through any two codes. The number can get the number in the middle of the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
图4示出了根据本发明的实施例的消息接收方法的流程图。Fig. 4 shows a flowchart of a message receiving method according to an embodiment of the present invention.
如图4所示,根据本发明的实施例的消息接收方法,包括:步骤402,接收所述消息发送装置发送的多个发送消息和与所述多个发送消息中每个发送消息对应的发送编号;步骤404,根据预设编号分配顺序和接收到的发送编号的接收顺序,确定所述消息接收装置未接收到的发送消息。As shown in FIG. 4, the message receiving method according to the embodiment of the present invention includes: Step 402, receiving multiple sending messages sent by the message sending device and sending messages corresponding to each sending message in the multiple sending messages Numbering; step 404, according to the preset number allocation sequence and the receiving sequence of the received sending numbers, determine the sending messages not received by the message receiving device.
在该技术方案中,消息发送装置根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,消息接收装置根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, the message sending device assigns a sending number to each sending message according to the preset numbering sequence and the sending order of each sending message among the multiple sending messages sent to the same message receiving device, and each sending number Unique, and multiple sending numbers are continuous, for example, assign numbers from 1 to 10 to 10 sending messages sent to a message receiving device, so that the message receiving device according to the numbering sequence and the number of the received sending message, It can be determined that the sent messages that have not been received, such as receiving the sent messages numbered 1, 2, 3, and 6, then it can be determined that the sent messages numbered 4 and 5 between the number 3 and the number 6 have not been received, so that The message receiving device requests the message sending device to send messages numbered 4 and 5 again, so as to realize reliable transmission of unreliable links and ensure data transmission security.
在上述技术方案中,优选地,还包括:将接收到的多个发送消息发送至所述消息接收队列中;按照预设时间间隔判断所述消息接收队列中是否存在发送消息;在判断结果为所述消息接收队列中存在所述发送消息时,获取所述消息发送队列中的当前队首发送消息;根据所述预设编号分配顺序将所述当前队首发送消息对应的第一发送编号与上一次解析的发送消息对应的第二发送消息编号进行比较;以及根据所述第一发送消息和所述第二发送消息的比较结果确定所述第一发送编号与所述第二发送编号之间是否存在未接收到的其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, it also includes: sending the received multiple sending messages to the message receiving queue; judging whether there is a sending message in the message receiving queue according to a preset time interval; when the judgment result is When there is the sending message in the message receiving queue, obtain the current team head sending message in the message sending queue; according to the preset number allocation sequence, the first sending number corresponding to the current team leader sending message and comparing the second sent message number corresponding to the last parsed sent message; and determining the difference between the first sent number and the second sent message according to the comparison result between the first sent message and the second sent message Whether there are other send numbers that have not been received to determine if there are send messages that have not been received.
在该技术方案中,消息发送装置根据预设编号顺序和发送至同一个消息接收装置的多个发送消息中每个发送消息的发送顺序为每个发送消息分配一个发送编号,并且每个发送编号唯一,且多个发送编号连续,比如,为发送至一个消息接收装置的10个发送消息分别分配从1到10的数字编号,这样,消息接收装置根据编号顺序和接收到的发送消息的编号,可以确定未接收到的发送消息,比如接收到编号为1,2,3,6的发送消息,则此时可以确定编号3和编号6之间编号为4和5的发送消息未接收到,从而由消息接收装置重新向消息发送装置请求发送编号为4和5的消息,从而实现不可靠链路的可靠传输,保证数据的传输安全。In this technical solution, the message sending device assigns a sending number to each sending message according to the preset numbering sequence and the sending order of each sending message among the multiple sending messages sent to the same message receiving device, and each sending number Unique, and multiple sending numbers are continuous, for example, assign numbers from 1 to 10 to 10 sending messages sent to a message receiving device, so that the message receiving device according to the numbering sequence and the number of the received sending message, It can be determined that the sent messages that have not been received, such as receiving the sent messages numbered 1, 2, 3, and 6, then it can be determined that the sent messages numbered 4 and 5 between the number 3 and the number 6 have not been received, so that The message receiving device requests the message sending device to send messages numbered 4 and 5 again, so as to realize reliable transmission of unreliable links and ensure data transmission security.
在上述技术方案中,优选地,还包括:在判断结果为所述接收队列中不存在所述发送消息时,向所述消息发送装置发送最新发送编号查询请求;在接收到所述消息发送装置发送的最新发送编号时,根据所述预设编号分配顺序将所述最新发送编号与所述当前队首发送消息的所述第一发送编号进行比较;根据所述第一发送编号和所述最新发送编号的比较结果确定所述最新发送编号和所述第一发送编号之间是否存在未接收到的所述其他发送编号,以确定是否存在未接收到的发送消息。In the above technical solution, preferably, it further includes: when the result of the judgment is that the sending message does not exist in the receiving queue, sending the latest sending number query request to the message sending device; When sending the latest sending number, compare the latest sending number with the first sending number of the current team head sending message according to the preset number allocation order; according to the first sending number and the latest The comparison result of the transmission number determines whether there is the other transmission number that has not been received between the latest transmission number and the first transmission number, so as to determine whether there is an unreceived transmission message.
在该技术方案,消息接收装置将接收到的发送消息放入消息接收队列中,并从消息接收队列中提取发送消息进行解析,在上一次解析完成时,则从队首获取发送消息进行解析,在获取到发送消息时,将该发送消息的发送编号与上一次解析的发送消息的发送编号进行比较,进而判断两者是否是相邻的,如果两者相邻,则说明不存在未接收到的消息,如果两者不相邻,则说明中间有未接收到的消息。In this technical solution, the message receiving device puts the received sending message into the message receiving queue, and extracts the sending message from the message receiving queue for analysis, and when the last analysis is completed, obtains the sending message from the head of the queue for analysis, When the sending message is obtained, compare the sending number of the sending message with the sending number of the last parsed sending message, and then judge whether the two are adjacent. If the two are adjacent, it means that there is no unreceived If the two are not adjacent, it means that there is an unreceived message in the middle.
在上述技术方案中,优选地,还包括:在所述第一发送编号和所述第二发送编号之间存在所述其他发送编号时,将所述其他发送编号发送至所述消息发送装置,以供所述消息发送装置查找并发送所述其他发送编号对应的发送消息至所述消息接收装置,以及接收所述消息发送装置发送的所述其他发送编号对应的发送消息。In the above technical solution, preferably, further comprising: when there is the other sending number between the first sending number and the second sending number, sending the other sending number to the message sending device, For the message sending device to find and send the sending message corresponding to the other sending number to the message receiving device, and receive the sending message corresponding to the other sending number sent by the message sending device.
在该技术方案中,消息接收装置如果未接收到新消息,按照预设时间间隔(如5秒钟)会向消息发送装置发送一次最新发送编号查询请求,从而方便消息接收装置确定是否已经接收到消息发送装置发送的所有发送消息,是否有未接收到的发送消息。In this technical scheme, if the message receiving device does not receive a new message, it will send a query request for the latest sending number to the message sending device according to a preset time interval (such as 5 seconds), so that the message receiving device can determine whether it has received the new message. All sent messages sent by the message sending device, whether there are unreceived sent messages.
在上述技术方案中,优选地,根据所述第一发送消息和所述第二发送消息的比较结果确定所述第一发送编号与所述第二发送编号之间是否存在未接收到的其他发送编号,具体包括:在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之前时,将所述第一发送编号对应的发送消息舍弃,并确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序相邻时,确定所述第一发送编号与所述第二发送编号之间不存在未接收到的其他发送编号;在所述第一发送编号的编号分配顺序位于所述第二发送编号的编号分配顺序之后,且所述第一发送编号与所述第二发送编号的编号分配顺序不相邻时,确定所述第一发送编号与所述第二发送编号之间存在未接收到的其他发送编号,并根据所述第一发送编号的编号分配顺序和所述第二发送编号的编号分配顺序确定未接收到的其他发送编号;以及In the above technical solution, preferably, it is determined whether there are other unreceived transmissions between the first transmission number and the second transmission number according to the comparison result of the first transmission message and the second transmission message numbering, specifically including: discarding the sending message corresponding to the first sending number when the number allocation sequence of the first sending number is before that of the second sending number, and determining the first sending number There is no other unreceived transmission number between the number and the second transmission number; the number allocation sequence of the first transmission number is after the number allocation sequence of the second transmission number, and the first transmission number When the number is adjacent to the number allocation sequence of the second transmission number, it is determined that there is no other transmission number that has not been received between the first transmission number and the second transmission number; When the number allocation sequence is after the number allocation sequence of the second transmission number, and the number allocation sequence of the first transmission number is not adjacent to the second transmission number, determine that the first transmission number and the second transmission number are not adjacent to each other. There are other transmission numbers that have not been received between the two transmission numbers, and determine the other transmission numbers that have not been received according to the number allocation sequence of the first transmission number and the number allocation sequence of the second transmission number; and
所述根据所述第一发送编号和所述最新发送编号的比较结果确定所述最新发送编号和所述第一发送编号之间是否存在未接收到的所述其他发送编号,具体包括:在所述第一发送编号与所述最新发送编号一致时,确定不存在未接收到的发送消息;在所述第一发送编号与所述最新发送编号不一致时,确定存在未接收到的发送消息,并根据所述第一发送编号的编号分配顺序和所述最新发送编号的编号分配顺序确定未接收到的其他发送编号。The determining according to the comparison result of the first sending number and the latest sending number whether there are other sending numbers that have not been received between the latest sending number and the first sending number specifically includes: When the first transmission number is consistent with the latest transmission number, it is determined that there is no unreceived transmission message; when the first transmission number is inconsistent with the latest transmission number, it is determined that there is an unreceived transmission message, and Other transmission numbers that have not been received are determined according to the number allocation sequence of the first transmission number and the number allocation sequence of the latest transmission number.
在该技术方案中,具体地,可以根据发送编号的是否相邻或一致,或者其前后顺序确定两个发送编号之间是否存在其他编号。其中,发送编号包括但是不限于数字编号和字母编号,其中,各发送编号为连续编号,连续编号是指有前后连续关系的代码的组合,能判断大小,并且能通过任意两个编号能得出两者中间的编号。当发送编号是数字编号时,如十进制的数字:编号110的下一个编号为111,编号110和编号115之间的编号为111,112,113和114。当发送编号为字母编号时,如aaa的下一个编号为aab,aab和aad中间的编号为aac。类似的例子还有很多,总之,只要能比较任何两个编号的大小,能通过一个编号得到它的下一个编号,能通过任何两个编号能得到中间的编号的所有的有规则的代码组合都符合要求。In this technical solution, specifically, it may be determined whether there are other numbers between two sending numbers according to whether the sending numbers are adjacent or consistent, or their sequence. Among them, the transmission number includes but is not limited to a number number and a letter number. Among them, each transmission number is a continuous number, and a continuous number refers to a combination of codes with a continuous relationship between the front and back, which can determine the size, and can be obtained by any two numbers. number between the two. When sending numbers are numeric numbers, such as decimal numbers: the next number from number 110 is 111, and the numbers between number 110 and number 115 are 111, 112, 113, and 114. When the sending number is a letter number, for example, the next number of aaa is aab, and the number between aab and aad is aac. There are many similar examples. In short, as long as the size of any two numbers can be compared, the next number can be obtained through one number, and all regular code combinations that can obtain the middle number through any two numbers are acceptable. meet the requirements.
图5示出了根据本发明的实施例的数据交互系统的框图。Fig. 5 shows a block diagram of a data interaction system according to an embodiment of the present invention.
如图5所示,根据本发明的实施例的数据交互系统500包括上述任一技术方案中的消息发送装置300和上述任一技术方案中的消息接收装置400。As shown in FIG. 5 , a data interaction system 500 according to an embodiment of the present invention includes a message sending device 300 in any of the above technical solutions and a message receiving device 400 in any of the above technical solutions.
其中,消息发送装置负责:Among them, the message sending device is responsible for:
1.组织消息1. Organize messages
2.给同一消息接收装置的消息加上唯一的连续编号。2. Add a unique serial number to the messages of the same message receiving device.
3.把最近发出的消息和消息对应的编号进行关联存储。3. Associate and store the most recently sent message with the number corresponding to the message.
4.开启编号查询服务,消息接收装置可以通过该服务,查到消息发送装置最新发送给该消息接收装置的消息编号。4. Open the number query service, and the message receiving device can find out the latest message number sent to the message receiving device by the message sending device through this service.
5.开启数据存取服务,消息接收装置可以通过该服务,通过消息编号来获得消息体。5. Open the data access service, and the message receiving device can obtain the message body through the service and the message number.
其中,如图6所示,消息发送流程包括:Among them, as shown in Figure 6, the message sending process includes:
步骤602,组织消息。Step 602, organizing messages.
步骤604,查看上次发送给该消息接收装置的消息编号并且把该编号+1。Step 604, check the number of the message sent to the message receiving device last time and add 1 to the number.
步骤606,把消息和编号组成一条新消息发送给消息接收装置。In step 606, a new message is composed of the message and the serial number and sent to the message receiving device.
步骤608,本地存储该消息和对应的消息编号。Step 608, locally store the message and the corresponding message number.
其中,消息接收装置负责:Among them, the message receiving device is responsible for:
1.通过链路接受消息。1. Accept the message through the link.
2.通过编号校验和定时心跳的方式获取自己丢失消息的消息编号。2. Obtain the message number of the lost message by means of number verification and timing heartbeat.
3.向消息发送装置发送编号,通过编号取回丢失的消息。3. Send the number to the message sending device, and retrieve the lost message through the number.
其中,如图7所示,消息接收流程包括:Wherein, as shown in Figure 7, the message receiving process includes:
步骤702,监听接收端口,获取发送端发送来的消息。Step 702, monitor the receiving port, and obtain the message sent by the sending end.
步骤704,把消息发到接收队列中去。Step 704, send the message to the receiving queue.
步骤706,重复步骤702和步骤704。Step 706, repeat step 702 and step 704.
下面以发送编号为数字编号为例,详细说明本发明的技术方案。The technical scheme of the present invention will be described in detail below by taking the sending number as a digital number as an example.
如图8所示,根据本发明的实施例的消息接收方法的具体流程包括(其中,设最新消息编号为n,初始为0):As shown in FIG. 8, the specific flow of the message receiving method according to the embodiment of the present invention includes (wherein, the latest message number is set to n, initially 0):
步骤802,判断接收队列中是否存在消息,在判断结果为是时,进入步骤804,在判断结果为否时,进入步骤806。Step 802, judging whether there is a message in the receiving queue, if the judging result is yes, go to step 804, and if the judging result is no, go to step 806.
步骤804,去队首消息。Step 804, go to the head of the team for a message.
步骤806,m秒内不断检测接收队列是否有新消息。Step 806, continuously check whether there is a new message in the receiving queue within m seconds.
步骤808,判断是否有新消息,在判断结果为是时,进入步骤804,在判断结果为否时,进入步骤826。Step 808, judging whether there is a new message, if the judging result is yes, go to step 804, and if the judging result is no, go to step 826.
步骤810,判断消息编号是否比n大1,在判断结果为是时,进入步骤812,在判断结果为否时,进入步骤814。Step 810, judge whether the message number is greater than n by 1, if the judgment result is yes, go to step 812, if the judgment result is no, go to step 814.
步骤812,取消息并解析。Step 812, get the message and parse it.
步骤814,判断消息编号是否比n大,在判断结果为是时,进入步骤818,在判断结果为否时,进入步骤816。Step 814, judge whether the message number is greater than n, if the judgment result is yes, go to step 818, if the judgment result is no, go to step 816.
步骤816,舍弃该消息,n不变。Step 816, the message is discarded, and n remains unchanged.
步骤818,用消息编号n得到夹在2个数之间的消息编号。Step 818, use the message number n to get the message number sandwiched between 2 numbers.
步骤820,向消息发送装置提供上一步的消息编号,得到这些消息编号对应的消息。Step 820, provide the message numbers in the previous step to the message sending device, and obtain messages corresponding to these message numbers.
步骤822,使n等于这些消息里最新的消息编号。Step 822, make n equal to the latest message number of these messages.
步骤824,依次解析这些消息。Step 824, parse these messages in sequence.
步骤826,向消息发送装置请求最新的消息编号。Step 826, request the latest message number from the message sending device.
步骤828,判断最新的消息编号和n是否一致,在判断结果为是时,返回步骤802,在判断结果为否时,进入步骤830。Step 828, judge whether the latest message number is consistent with n, if the judgment result is yes, return to step 802, and if the judgment result is no, enter step 830.
步骤830,计算出没有接收到的消息编号。Step 830, calculate the number of the message that has not been received.
以上结合附图详细说明了本发明的技术方案,通过本发明的技术方案,可以在不可靠的链路下使消息可以进行可靠传输,从而确保传输的安全性和可靠性。The above describes the technical solution of the present invention in detail in conjunction with the accompanying drawings. Through the technical solution of the present invention, messages can be reliably transmitted under unreliable links, thereby ensuring the security and reliability of transmission.
以上所述仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above descriptions are only preferred embodiments of the present invention, and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and changes. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention shall be included within the protection scope of the present invention.
Claims (21)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410413075.2A CN105450365A (en) | 2014-08-20 | 2014-08-20 | Message-sending device and method, message-receiving device and method, and message interaction system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201410413075.2A CN105450365A (en) | 2014-08-20 | 2014-08-20 | Message-sending device and method, message-receiving device and method, and message interaction system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN105450365A true CN105450365A (en) | 2016-03-30 |
Family
ID=55560197
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201410413075.2A Pending CN105450365A (en) | 2014-08-20 | 2014-08-20 | Message-sending device and method, message-receiving device and method, and message interaction system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN105450365A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106027379A (en) * | 2016-07-28 | 2016-10-12 | 贵州中科汉天下信息技术有限公司 | Push message receiving processing method |
CN109040118A (en) * | 2018-09-06 | 2018-12-18 | 北京达佳互联信息技术有限公司 | Message treatment method, device, electronic equipment and storage medium |
CN111083145A (en) * | 2019-12-18 | 2020-04-28 | 北京华宇信息技术有限公司 | Message sending method and device and electronic equipment |
CN111953618A (en) * | 2020-08-21 | 2020-11-17 | 锐捷网络股份有限公司 | Disorder-removing method, device and system under multistage parallel exchange architecture |
CN114020495A (en) * | 2021-11-10 | 2022-02-08 | 中国建设银行股份有限公司 | Information processing system, method, device, equipment and medium |
Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040100964A1 (en) * | 2002-11-27 | 2004-05-27 | Robotham Robert E. | System and method for detecting lost messages transmitted between modules in a communication device |
CN101656756A (en) * | 2009-09-17 | 2010-02-24 | 中国科学院声学研究所 | File transferring method with self-adaptive control of transmission speed and system thereof |
CN102132515A (en) * | 2008-08-20 | 2011-07-20 | 三星电子株式会社 | Apparatus and method for generating automatic repeat request (arq) feedback message in wireless communication system |
CN102571635A (en) * | 2012-01-18 | 2012-07-11 | 浪潮(北京)电子信息产业有限公司 | Message transmission method and equipment |
CN102655449A (en) * | 2012-03-31 | 2012-09-05 | 杭州再灵电子科技有限公司 | Communication method of modem |
CN103220206A (en) * | 2012-01-19 | 2013-07-24 | 阿里巴巴集团控股有限公司 | Message sending method and device and message receiving method and device |
CN103561394A (en) * | 2013-11-08 | 2014-02-05 | 惠州Tcl移动通信有限公司 | Method and system for sending message |
-
2014
- 2014-08-20 CN CN201410413075.2A patent/CN105450365A/en active Pending
Patent Citations (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20040100964A1 (en) * | 2002-11-27 | 2004-05-27 | Robotham Robert E. | System and method for detecting lost messages transmitted between modules in a communication device |
CN102132515A (en) * | 2008-08-20 | 2011-07-20 | 三星电子株式会社 | Apparatus and method for generating automatic repeat request (arq) feedback message in wireless communication system |
CN101656756A (en) * | 2009-09-17 | 2010-02-24 | 中国科学院声学研究所 | File transferring method with self-adaptive control of transmission speed and system thereof |
CN102571635A (en) * | 2012-01-18 | 2012-07-11 | 浪潮(北京)电子信息产业有限公司 | Message transmission method and equipment |
CN103220206A (en) * | 2012-01-19 | 2013-07-24 | 阿里巴巴集团控股有限公司 | Message sending method and device and message receiving method and device |
CN102655449A (en) * | 2012-03-31 | 2012-09-05 | 杭州再灵电子科技有限公司 | Communication method of modem |
CN103561394A (en) * | 2013-11-08 | 2014-02-05 | 惠州Tcl移动通信有限公司 | Method and system for sending message |
Non-Patent Citations (1)
Title |
---|
唯贤: "即时消息用户行为和网络特征的分析", 《中国优秀硕士学位论文全文数据库信息科技辑》 * |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106027379A (en) * | 2016-07-28 | 2016-10-12 | 贵州中科汉天下信息技术有限公司 | Push message receiving processing method |
CN109040118A (en) * | 2018-09-06 | 2018-12-18 | 北京达佳互联信息技术有限公司 | Message treatment method, device, electronic equipment and storage medium |
CN111083145A (en) * | 2019-12-18 | 2020-04-28 | 北京华宇信息技术有限公司 | Message sending method and device and electronic equipment |
CN111953618A (en) * | 2020-08-21 | 2020-11-17 | 锐捷网络股份有限公司 | Disorder-removing method, device and system under multistage parallel exchange architecture |
CN111953618B (en) * | 2020-08-21 | 2022-07-19 | 锐捷网络股份有限公司 | Method, device and system for de-ordering under multistage parallel exchange architecture |
CN114020495A (en) * | 2021-11-10 | 2022-02-08 | 中国建设银行股份有限公司 | Information processing system, method, device, equipment and medium |
CN114020495B (en) * | 2021-11-10 | 2024-12-20 | 中国建设银行股份有限公司 | Information processing system, method, device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105450365A (en) | Message-sending device and method, message-receiving device and method, and message interaction system | |
US9892124B2 (en) | Method and device for transferring file | |
WO2019228369A1 (en) | Message processing method and related product | |
US10447796B2 (en) | Pushlet instant messaging framework and pushlet instant messaging method | |
US10552411B2 (en) | Email service adapter | |
WO2016090764A1 (en) | Short message transmitting method and device and computer storage medium | |
CN105471700B (en) | A kind of methods, devices and systems of Message Processing | |
CN109756401A (en) | A kind of test method, device, electronic equipment and storage medium | |
CN105391629B (en) | A kind of method and device of resource backup | |
CN105656769B (en) | Business data processing method, device and system | |
US20230043889A1 (en) | Message Processing Method and Device, Storage Medium, and Electronic Device | |
CN110324426A (en) | A kind of data capture method, device and system | |
RU2007131333A (en) | METHOD FOR PERSONAL TRANSMISSION OF INFORMATION BETWEEN USERS OF DATA TRANSFER NETWORK | |
CN105592135A (en) | Method and device for determination of data redundancy elimination DRD dictionary | |
EP2381620A1 (en) | Method for retrieving object from device management client and associated device management system | |
CN102571277A (en) | Method and device for sending serial number detection message | |
CN107347184A (en) | The detection of WIFI connection status, display methods and device, server and terminal device | |
CN106534140A (en) | Transmission system and method of SIP message | |
WO2016197917A1 (en) | Flow entry issuing method, flow entry storage method, relevant apparatus and system | |
US10262070B1 (en) | Supporting proximal communication between communication devices and broadcast stations | |
CN110708208B (en) | Monitoring data acquisition method and device, storage medium and terminal | |
KR20140042205A (en) | Spam call number management method | |
WO2018121353A1 (en) | Method of testing data channel, test server, and test system | |
CN111383776A (en) | System and method for monitoring pathological parameters | |
CN110347632B (en) | Communication method and device |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20160330 |