WO2017173915A1 - Message processing method, device, and system, and computer storage medium - Google Patents

Message processing method, device, and system, and computer storage medium Download PDF

Info

Publication number
WO2017173915A1
WO2017173915A1 PCT/CN2017/076784 CN2017076784W WO2017173915A1 WO 2017173915 A1 WO2017173915 A1 WO 2017173915A1 CN 2017076784 W CN2017076784 W CN 2017076784W WO 2017173915 A1 WO2017173915 A1 WO 2017173915A1
Authority
WO
WIPO (PCT)
Prior art keywords
message
clock
time
packet
timestamp
Prior art date
Application number
PCT/CN2017/076784
Other languages
French (fr)
Chinese (zh)
Inventor
刘峰
Original Assignee
中兴通讯股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2017173915A1 publication Critical patent/WO2017173915A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/55Prevention, detection or correction of errors
    • H04L49/557Error correction, e.g. fault recovery or fault tolerance
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/35Switches specially adapted for specific applications
    • H04L49/351Switches specially adapted for specific applications for local area network [LAN], e.g. Ethernet switches
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements

Definitions

  • the present invention relates to the field of data message transmission, and in particular, to a message processing method, apparatus, system, and computer storage medium.
  • Ethernet technology has made data services the main traffic of the network.
  • the data network has begun to replace the Synchronous Digital Hierarchy (SDH) network as the development direction of the communication network.
  • SDH Synchronous Digital Hierarchy
  • PTN Packet Transport Network
  • IPRAN IP Radio Access Network
  • the data network has low comprehensive cost and flexible service scheduling capability, which satisfies the transmission requirements of current data services.
  • data networks have uncertainties in delay time and delay time jitter in service transmission. In some areas, they are not sensitive to the transmission duration of data packets, but are very sensitive to changes in message delivery time.
  • the control center needs to make the power generation switch command of the two power stations upstream and downstream, and the command transmission time is determined to ensure that the upstream and downstream electric switch operates the electric switch according to the command sequence relationship, and the switching sequence of the upstream and downstream electric switches There are strict requirements, and the wrong order of the electric gate will cause disorder of the power operation of the grid, causing disaster. Due to the uncertain message delivery time of the data network, the demand for the power private network cannot be met.
  • the embodiments of the present invention are directed to a packet processing method, apparatus, system, and computer storage medium, which are intended to solve the problem that the data packet transmission time is unstable in the prior art, thereby causing security risks and the like.
  • an embodiment of the present invention provides a packet sending method, including:
  • the sending, by the data network, the timestamp and the packet includes: inserting the timestamp into the packet; re-encapsulating the packet; The data network sends the repackaged message.
  • the embodiment of the invention further provides a packet receiving method, including:
  • the message is buffered, wherein the egress clock is synchronized with the entry clock.
  • determining the output moment of the packet according to the timestamp and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report The output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay.
  • the method further includes: outputting the message.
  • the outputting the packet includes: removing the timestamp from the packet; and re-performing the packet Package and output.
  • the embodiment of the invention further provides a packet processing method, including:
  • the message is buffered, wherein the egress clock is synchronized with the entry clock.
  • the sending, by the data network, the timestamp and the packet includes: inserting the timestamp into the packet; re-encapsulating the packet, and passing the The data network sends the repackaged message.
  • determining the output moment of the packet according to the timestamp and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report The output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay.
  • the method further includes: outputting the message.
  • the outputting the packet includes: removing the timestamp from the packet; and re-performing the packet Package and output.
  • the embodiment of the invention further provides a message sending device, comprising:
  • a packet generation module configured to obtain a packet
  • a time recording module configured to record a timestamp of an entry clock when the packet enters the data network; wherein the entry clock is synchronized with an exit clock;
  • the message sending module is configured to send the timestamp and the message through the data network.
  • the packet sending module includes a first encapsulating module configured to The timestamp is inserted into the packet, and the packet is re-encapsulated.
  • the embodiment of the invention further provides a message receiving device, comprising:
  • a message receiving module configured to receive a message through the data network and a timestamp of an entry clock when the message enters the data network
  • a time determining module configured to determine an output moment of the packet according to the timestamp and a preset maximum delay
  • the message cache module is configured to cache the message when the time point of the egress clock is less than the output time, wherein the egress clock is synchronized with the entry clock.
  • the time determining module is configured to calculate a sum of the timestamp and the preset maximum delay, and determine that an output time of the packet is greater than or equal to the timestamp and the preset maximum Sum of delay
  • the device further includes a message output module configured to output the message when a time point of the exit clock is greater than or equal to the output time.
  • the packet output module includes a second encapsulating module, configured to remove the timestamp from the packet, The message is repackaged and output.
  • the embodiment of the invention further provides a message processing system, including a message sending device and a message receiving device;
  • the message sending device is configured to obtain a message; record a timestamp of an entry clock when the message enters the data network; wherein the entry clock is synchronized with an exit clock; and the timestamp is sent through the data network Transmitting the message to the message receiving device;
  • the packet receiving device is configured to receive a packet through a data network and a timestamp of an entry clock when the packet enters the data network; and determine the packet according to the timestamp and a preset maximum delay. Output time; when the time point of the exit clock is less than the output time, the message is buffered, and the exit clock is synchronized with the entry clock.
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the application in the message sending apparatus according to the embodiment of the present invention.
  • Message sending method a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the application in the message sending apparatus according to the embodiment of the present invention.
  • the embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the application in the message receiving apparatus according to the embodiment of the present invention.
  • Message receiving method a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the application in the message receiving apparatus according to the embodiment of the present invention.
  • the data sending device obtains a packet, records a timestamp of the entry clock when the packet enters the data network, and sends the timestamp through the data network.
  • the data receiving device receives the packet and the timestamp of the entry clock when the packet enters the data network, and determines the output time of the packet according to the timestamp and the preset maximum delay. When the time point of the exit clock is less than the output time, the message is buffered.
  • the technical solution of the embodiment overcomes the problem that the message output is indeterminate due to the time uncertainty of the transmission of the message in the data network, so that the message can be transmitted according to a fixed time, which facilitates subsequent processing and expands
  • the application range of the data network has improved the user experience.
  • FIG. 1 is a flowchart of a method for sending a message according to an embodiment of the present invention
  • FIG. 2 is a flowchart of a method for receiving a message according to an embodiment of the present invention
  • FIG. 3 is a flowchart of a packet processing method according to an embodiment of the present invention.
  • FIG. 4 is a schematic diagram of a packet sending apparatus module according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a packet receiving apparatus module according to an embodiment of the present invention.
  • FIG. 6 is a flowchart of a packet processing method according to an embodiment of the present invention.
  • the embodiment of the present invention enters the data network.
  • the interval stamp and the preset maximum delay are such that when the message is transmitted to the message receiving device, the output can be output only when the output time is satisfied, thereby avoiding the message being transmitted without restriction. If the transmission time is uncertain, the message must be delayed by the preset maximum delay, which facilitates subsequent operations and expands the application range of the data network.
  • the embodiment provides a packet sending method, and the packet sending method can be applied to a packet sending apparatus.
  • Figure 1 including:
  • S102 Record a timestamp of an entry clock when the packet enters the data network, where the entry clock is synchronized with an exit clock.
  • S103 Send the timestamp and the packet by using the data network.
  • the message may be generated by the message sending device, but not necessarily generated by the message sending device itself, or may be sent to the message sending device after being generated by another device.
  • the message sending device is a starting point for the message to be sent through the data network, and the message enters the data network in the message sending device.
  • the message sending device sends the message through the data network, and the message sending device is the starting point of the data network; when the message is sent, when the message is entered into the data network, A timestamp of the entry clock, the timestamp corresponding to the message.
  • an entry clock is set at a location where the packet enters the data network, that is, an entry clock is set at an output port of the packet sending device, and the entry clock is used to record the time when the packet enters the data network in real time. .
  • the recording precision of the entry clock can be very high, and can be accurate to the moment when the message enters the data network, that is, the time at which the time is recorded; for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, and the like; The higher the accuracy, the smaller the fluctuation in transit time.
  • the form or principle of the clock whether it is a mechanical clock, an electronic clock, a quartz clock, or the original Zizhong, etc., are all feasible.
  • the time of the entry of the message sending device and the time of the exit clock of the message receiving device should be synchronized, as the time required for the message sending device to transmit the message and the time at which the message receiving device receives the message are recorded;
  • the meaning of synchronization is that the time of the entry clock and the exit clock are the same, or the conversion relationship between the time of the entry clock and the time of the exit clock is determined. For example, the time zone where Beijing is located is Dongba District, and the time zone where Tokyo is located is Dongjiu District. Then there is an hour difference between Beijing time and Tokyo time; therefore, if the message sending device is in Beijing, it is reported. If the text receiving device is in Tokyo, the time stamp of the record should be added by one hour, or the time of the exit clock should be subtracted by one hour, so that the entry clock and the exit clock can be synchronized.
  • the manner of synchronizing the ingress clock and the egress clock may include multiple types.
  • the synchronization mode of the clock is divided into two categories: one is to synchronize between the egress clock and the ingress clock, that is, Taking an exit clock/ingress clock as a reference, the entry clock corresponding to the exit clock is coincident with the exit clock, or the exit clock corresponding to the entry clock is consistent with the entry clock;
  • the absolute time of the clock is not necessarily accurate, but has no effect on the implementation of the embodiment.
  • the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock.
  • the exit clock and the entry clock are both synchronized with the reference clock, and correspondingly, the synchronization between the exit clock and the entry clock is achieved.
  • the synchronization method may include: Global Positioning System (GPS), Network Time Protocol (NTP), China Beidou satellite navigation system, atomic clock, IEEE1588 (precision clock synchronization of network measurement and control system) Protocol standard) and so on any synchronization.
  • the packet sending apparatus has acquired the timestamp corresponding to the packet; in order to enable the timestamp to be known by the packet receiving apparatus, the timestamp and the packet need to be combined and passed. Data network is sent.
  • the reason for sending in combination is to avoid messages and time.
  • the stamp cannot arrive at the message receiving device at the same time, thereby causing trouble for the message receiving device to perform the comparison.
  • the implementation of the embodiment does not have much influence.
  • the time stamp is inserted into the packet, so that the packet and the corresponding time stamp arrive at the same time.
  • Text receiving device can be inserted into any of a plurality of locations in the packet, such as a packet header, a packet header, and a payload, or a trailer at the end of the packet.
  • the packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated.
  • the re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the cyclic redundancy of the packet. Code check (CRC, Cyclic Redundancy Code) check byte, etc.
  • CRC Cyclic Redundancy Code
  • the embodiment further provides a message receiving method, and the message receiving method can be applied to a message receiving device.
  • Figure 2 including:
  • S201 Receive a packet through a data network, and a timestamp of an entry clock when the packet enters the data network.
  • S202 Determine, according to the timestamp and the preset maximum delay, an output moment of the packet.
  • the received message is a packet transmitted through the data network; the packet transmission time is not determined, that is, the time of transmission and the arrival time of the packet are not determined, because the data network itself There is no fixed transmission time.
  • the timestamp is the time of the entry clock when the message enters the data network.
  • the timestamp and the packet combination are sent through the data network, that is, the time.
  • the stamp and the message arrive at the message output device at the same time; the reason for the combination is to prevent the message and the time stamp from being able to reach the message receiving device at the same time, thereby causing trouble for the message receiving device to perform the comparison.
  • the implementation of the embodiment does not have much influence.
  • the packet receiving apparatus in addition to the timestamp corresponding to the received message, the packet receiving apparatus further has a preset maximum delay and a time point of the exit clock.
  • the time point of the exit clock is the time indicated by the exit clock.
  • the exit clock is similar to the entrance clock. Its accuracy can be very high, for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, etc. The higher the accuracy, the more accurate the message delivery time.
  • the output is expected to be delayed; in this embodiment, the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like.
  • the accuracy of the exit clock may be the same as the accuracy of the entry clock.
  • determining the output time of the packet according to the timestamp corresponding to the packet and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report.
  • the output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay.
  • the output time refers to a time point, and the message is allowed to output at a time point that satisfies the sum of the time stamp equal to or greater than the preset maximum time, and is also allowed to satisfy the time greater than the sum of the time stamp and the preset maximum time. Point output; although the output time is a time point, it does not mean that the message will be output at this moment.
  • the output time is the earliest time point at which the message is allowed to be output, that is, a time point, which can be guaranteed.
  • the message can be sent from the transmission to the output for a fixed period of time and this fixed time is as short as possible, ensuring efficiency.
  • the preset maximum delay is also mentioned above. Since the time for transmitting the packet in the data network is not fixed, in this embodiment, a fixed preset maximum delay is set, and the time between sending and output of the packet is determined by the preset maximum delay. Fixed, the fixed transmission time is the preset maximum delay.
  • the preset maximum delay is a preset time delay for the message to be fixed. time. Generally speaking, although the transmission time of the packets transmitted in the data network is not fixed, there is usually a maximum transmission time, that is, the maximum delay time. In the normal transmission process, the message does not exceed this maximum. The delay time, the transmission time is less than this maximum delay time.
  • the maximum delay time is generally experimental data, that is, a value determined by multiple sampling, from the message transmitting device to the message receiving device, under normal circumstances, the delay time of the message is not exceeded at most.
  • the preset maximum delay in this embodiment generally refers to the maximum delay time, so that the time that the packet is transmitted in the data network does not exceed the preset maximum delay, so that the packet can be sent from the The output period is fixed, reducing or not causing fluctuations, making the transmission of the message more stable.
  • the preset maximum delay can also be adjusted according to the needs, as long as it is within a reasonable range.
  • the message when the time point of the exit clock is less than the output time, the message is buffered.
  • the time point of the egress clock is not only the time when the packet arrives at the packet receiving device, and the time point of the egress clock refers to the time indicated on the egress clock; The reminder time is always elapsed. Therefore, when the time point of the exit clock is less than the output time, the comparison should be continued. If the time of the exit clock is less than the output time, the message can be output when the output clock reaches the output time; if the time of the exit clock is greater than the output time, the message can be directly output. In other words, when the time point of the exit clock is less than the output time, the output time is the time when the true output of the message is outward; when the time point of the exit clock is greater than the output time, the message can be directly output.
  • the time point of the egress clock or the difference between the elapsed clock prompt time and the time stamp is the time when the packet is transmitted in the data network. It can be seen from the foregoing that this time is not fixed, and it is often floating. Therefore, this embodiment provides the concept of preset maximum delay; if the time point of the exit clock is always smaller than the output time, the The message is cached. During the buffering, the time of the exit clock will be closer to the output time, and when the time of the exit clock is equal to the output time, The message can be output.
  • the exit clock should be synchronized with the entry clock; the meaning of synchronization is that the time of the entry clock and the exit clock are the same, or between the time of the entry clock and the time of the exit clock.
  • the conversion relationship is deterministic.
  • the synchronization mode between the egress clock and the ingress clock may include multiple types.
  • the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock. That is, the egress clock corresponding to the egress clock is aligned with the egress clock, or the egress clock corresponding to the ingress clock is consistent with the entry clock, based on the egress clock/ingress clock;
  • the absolute time of the two clocks is not necessarily accurate, but has no effect on the implementation of the embodiment, as long as the time synchronization between the two is sufficient; the second is that both the exit clock and the entry clock are synchronized with the reference clock, that is,
  • a third-party standard clock is used as a reference, and is recorded as a reference clock, so that both the egress clock and the ingress clock are synchronized with the reference clock, and accordingly, the egress clock and the ingress clock are synchronized.
  • the synchronization method may include: GPS,
  • Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
  • the outputted message can be output to the desired place to achieve the desired function; in this embodiment, the time elapsed from the transmission of the message to the output is consistent, in other words, as long as the message is transmitted.
  • the sequence of the messages is set in sequence, it can ensure that when the message is output, it is also output according to the preset timing.
  • the timing between two messages is set. After the data network is transmitted, if the first message is received later, the message will be sent first.
  • the buffer is buffered when it does not meet the requirements of the output time, so that the first transmitted message can still be guaranteed to be output first; and the message transmitting device
  • the same is true for sending time-series messages to different message receiving devices. It is also possible to ensure that the timing of message transmission is consistent with the timing of reception, thereby making the user's operation easier and more reliable.
  • This embodiment provides a packet processing method. Referring to FIG. 3, the method includes:
  • the packet sending apparatus sends the timestamp and the packet to the packet receiving apparatus by using the data network.
  • the packet receiving device receives the packet through the data network, and a timestamp of the entry clock when the packet enters the data network.
  • S305 Determine, according to the timestamp and the preset maximum delay, an output moment of the packet.
  • the message may be generated by the message sending device, but not necessarily generated by the message sending device itself, or may be sent to the message sending device after being generated by another device.
  • the message sending device is a starting point for the message to be sent through the data network, and the message enters the data network at the point of the message sending device.
  • the message sending device sends the message through the data network, and the message sending device is the starting point of the data network; when the message is sent, when the message is entered into the data network, A timestamp of the entry clock, the timestamp corresponding to the message.
  • an entry clock is set at a location where the packet enters the data network, that is, an entry clock is set at an output port of the packet sending device, and the entry clock is used to record the time when the packet enters the data network in real time. .
  • the recording accuracy of the entry clock can be very high, and can be accurate to the moment when the message enters the data network, that is, the time at the time is recorded; for example, it can be accurate to seconds, milliseconds, subtle, or even Picoseconds, nanoseconds, etc.; the higher the precision, the smaller the fluctuation in transit time.
  • the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like.
  • the time of the entry of the message sending device and the time of the exit clock of the message receiving device should be synchronized, as the time required for the message sending device to transmit the message and the time at which the message receiving device receives the message are recorded;
  • the meaning of synchronization is that the time of the entry clock and the exit clock are the same, or the conversion relationship between the time of the entry clock and the time of the exit clock is determined. For example, the time zone where Beijing is located is Dongba District, and the time zone where Tokyo is located is Dongjiu District. Then there is an hour difference between Beijing time and Tokyo time; therefore, if the message sending device is in Beijing, it is reported. If the text receiving device is in Tokyo, the time stamp of the record should be added by one hour, or the time of the exit clock should be subtracted by one hour, so that the entry clock and the exit clock can be synchronized.
  • the manner of synchronizing the ingress clock and the egress clock may include multiple types.
  • the synchronization mode of the clock is divided into two categories: one is to synchronize between the egress clock and the ingress clock, that is, Taking an exit clock/ingress clock as a reference, the entry clock corresponding to the exit clock is coincident with the exit clock, or the exit clock corresponding to the entry clock is consistent with the entry clock;
  • the absolute time of the clock is not necessarily accurate, but has no effect on the implementation of the embodiment.
  • the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock.
  • the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
  • the packet sending apparatus has acquired the timestamp corresponding to the packet; in order to enable the timestamp to be known by the packet receiving apparatus, the timestamp and the packet need to be combined and passed. Data network is sent.
  • the reason for sending in combination is to avoid messages and time.
  • the stamp cannot arrive at the message receiving device at the same time, thereby causing trouble for the message receiving device to perform the comparison.
  • the implementation of the embodiment does not have much influence.
  • the time stamp is inserted into the packet, so that the packet and the corresponding time stamp arrive at the same time.
  • Text receiving device can be inserted into any of a plurality of locations in the packet, such as a packet header, a packet header, and a payload, or a trailer at the end of the packet.
  • the packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated.
  • the re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the CRC of the packet. Bytes, etc.
  • the encapsulated packet can be sent to the packet receiving device through the data network, and then the packet receiving device processes the packet.
  • the received message is a packet transmitted through the data network; the packet transmission time is not determined, that is, the time of transmission and the arrival time of the packet are not determined, because the data network itself There is no fixed transmission time.
  • the timestamp is the time of the entry clock when the message enters the data network.
  • the timestamp and the packet combination are sent through the data network, that is, the timestamp and the message arrive at the message output device at the same time; the reason for the combination is that the message and the timestamp cannot reach the message at the same time. Receiving the device, thereby causing trouble for the message receiving device to perform the comparison.
  • the implementation of the embodiment does not have much influence.
  • the packet receiving apparatus in addition to the timestamp corresponding to the received message, the packet receiving apparatus further has a preset maximum delay and a time point of the exit clock.
  • the time point of the exit clock is the time indicated by the exit clock.
  • the exit clock is similar to the entrance clock, and its accuracy can be very high. For example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, etc.; the higher the precision, the more accurate the message delivery time, and the more the message can be output with the expected delay; in this embodiment, the clock
  • the form, or principle is not limited, whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, etc., are all feasible.
  • the accuracy of the exit clock may be the same as the accuracy of the entry clock.
  • determining the output time of the packet according to the timestamp corresponding to the packet and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report.
  • the output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay.
  • the output time refers to a time point, and the message is allowed to output at a time point that satisfies the sum of the time stamp equal to or greater than the preset maximum time, and is also allowed to satisfy the time greater than the sum of the time stamp and the preset maximum time. Point output; although the output time is a time point, it does not mean that the message will be output at this moment.
  • the output time is the earliest time point at which the message is allowed to be output, that is, a time point, which can be guaranteed.
  • the message can be sent from the transmission to the output for a fixed period of time and this fixed time is as short as possible, ensuring efficiency.
  • the preset maximum delay is also mentioned above. Since the time for transmitting the packet in the data network is not fixed, in this embodiment, a fixed preset maximum delay is set, and the time between sending and output of the packet is determined by the preset maximum delay. Fixed, the fixed transmission time is the preset maximum delay.
  • the preset maximum delay is a preset time for delaying the message for a fixed period of time. Generally speaking, although the transmission time of the packets transmitted in the data network is not fixed, there is usually a maximum transmission time, that is, the maximum delay time. In the normal transmission process, the message does not exceed this maximum. The delay time, the transmission time is less than this maximum delay time.
  • the maximum delay time is generally experimental data, that is, a value determined by multiple sampling, from the message transmitting device to the message receiving device, under normal circumstances, the delay time of the message is not exceeded at most.
  • the preset maximum delay in this embodiment generally refers to the maximum delay time, so that the time that the packet is transmitted in the data network does not exceed the preset maximum delay, and therefore, the packet can be reported.
  • the time from the transmission to the output is fixed, reducing or not causing fluctuations, making the transmission of the message more stable.
  • the preset maximum delay can also be adjusted according to the needs, as long as it is within a reasonable range.
  • the message when the time point of the exit clock is less than the output time, the message is buffered.
  • the time point of the egress clock is not only the time when the packet arrives at the packet receiving device, and the time point of the egress clock refers to the time indicated on the egress clock; The reminder time is always elapsed. Therefore, when the time point of the exit clock is less than the output time, the comparison should be continued. If the time of the exit clock is less than the output time, the message can be output when the output clock reaches the output time; if the time of the exit clock is greater than the output time, the message can be directly output. In other words, when the time point of the exit clock is less than the output time, the output time is the time when the true output of the message is outward; when the time point of the exit clock is greater than the output time, the message can be directly output.
  • the time point of the egress clock or the difference between the elapsed clock prompt time and the time stamp is the time when the packet is transmitted in the data network. It can be seen from the foregoing that this time is not fixed, and it is often floating. Therefore, this embodiment provides the concept of preset maximum delay; if the time point of the exit clock is always smaller than the output time, the report is always The text is cached. During the buffering period, the time point of the exit clock will be closer to the output time, and when the time point of the exit clock is equal to the output time, the message can be output.
  • the exit clock should be synchronized with the entry clock; the meaning of synchronization is that the time of the entry clock and the exit clock are the same, or between the time of the entry clock and the time of the exit clock.
  • the conversion relationship is deterministic.
  • the synchronization mode between the egress clock and the ingress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock. That is, the exit clock/entry clock is used as a reference, and the exit clock is correspondingly entered.
  • the port clock is consistent with the egress clock, or the egress clock corresponding to the ingress clock is consistent with the ingress clock; the result of the synchronization is that the absolute time of the two clocks is not necessarily accurate, but the implementation of the embodiment is not Impact, as long as the time synchronization between the two can be; second, the exit clock and the entry clock are synchronized with the reference clock, that is, based on a third-party standard clock, recorded as the reference clock, making the exit clock And the entry clock are both synchronized with the reference clock, and correspondingly, the synchronization between the exit clock and the entry clock is achieved.
  • the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
  • Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
  • the outputted message can be output to the desired place to achieve the desired function; in this embodiment, the time elapsed from the transmission of the message to the output is consistent, in other words, as long as the message is transmitted.
  • the sequence of the messages is set in sequence, it can ensure that when the message is output, it is also output according to the preset timing.
  • the timing between two messages is set. After the data network is transmitted, if the first message is received later, the message will be sent first.
  • the buffer is not satisfied by the requirement of the output time, so that the first transmitted message can still be output first; and the message transmitting device sends the timed message to different message receiving devices, and the same can be performed. It ensures that the timing when the message is sent is consistent with the timing at the time of receiving, making the user's operation easier and more reliable.
  • This embodiment provides a message sending apparatus. Referring to FIG. 4, the method includes:
  • the message generating module 101 is configured to obtain a message
  • the time recording module 102 is configured to record a timestamp of the entry clock when the packet enters the data network; wherein the entry clock is synchronized with the exit clock;
  • the message sending module 103 is configured to send the timestamp and the message through the data network.
  • the packet may be generated by the packet generating module 101, and may not be generated by the packet generating module 101 itself, or may be sent to the packet sending device after being generated by other devices;
  • the text sending module 103 is a starting point for sending a message through the data network, and the message enters the data network in the message sending module 103.
  • the message sending module 103 sends the message through the data network, and the message sending module 103 is the starting point of the data network.
  • the time recording module 102 records the message.
  • the timestamp of the entry clock when entering the data network the timestamp corresponding to the message.
  • an entry clock is set at a location where the packet enters the data network, that is, an entry clock is set at an output port of the packet sending device, and the entry clock is used to record the time when the packet enters the data network in real time. .
  • the recording precision of the entry clock can be very high, and can be accurate to the moment when the message enters the data network, that is, the time at which the time is recorded; for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, and the like; The higher the accuracy, the smaller the fluctuation in transit time.
  • the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like.
  • the time of the exit clock and the exit clock of the packet receiving device should be synchronized because the time when the packet sending module 103 needs to send the packet and the time when the packet receiving device receives the packet should be synchronized; the meaning of the synchronization is that the entry is The time between the clock and the exit clock is the same, or the conversion relationship between the time of the entry clock and the time of the exit clock is determined. For example, the time zone where Beijing is located is Dongba District, and the time zone where Tokyo is located is Dongjiu District. Then there is an hour difference between Beijing time and Tokyo time; therefore, if the message sending device is in Beijing, it is reported. If the text receiving device is in Tokyo, the time stamp of the record should be added by one hour, or the time of the exit clock should be subtracted by one hour, so that the entry clock and the exit clock can be synchronized.
  • the manner of synchronizing the ingress clock and the egress clock may include multiple types.
  • the synchronization mode of the clock is divided into two categories: one is to synchronize between the egress clock and the ingress clock, that is, Taking an exit clock/ingress clock as a reference, the entry clock corresponding to the exit clock is coincident with the exit clock, or the exit clock corresponding to the entry clock is consistent with the entry clock;
  • the absolute time of the clock is not necessarily accurate, but has no effect on the implementation of the embodiment.
  • the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock.
  • the exit clock and the entry clock are both synchronized with the reference clock, and correspondingly, the synchronization between the exit clock and the entry clock is achieved.
  • the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
  • the time recording module 102 has acquired the timestamp corresponding to the message; in order to enable the timestamp to be known by the message receiving device, the timestamp and the message need to be combined and sent through the data network.
  • the reason for the combination transmission is to prevent the message and the time stamp from being able to reach the message receiving device at the same time, thereby causing trouble for the message receiving device to perform comparison.
  • the implementation of the embodiment does not have much influence.
  • the device further includes a first encapsulating module 1031, configured to insert the timestamp into the packet after the timestamp of the packet entering the data network is recorded, and the packet is inserted into the packet. Repackage. This ensures that the message and its corresponding timestamp will arrive at the message receiving device at the same time.
  • the timestamp can be inserted into any of a plurality of locations in the packet, such as a packet header, a packet header, and a payload, or a trailer at the end of the packet.
  • the packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated.
  • the re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the CRC of the packet. Bytes, etc.
  • the encapsulated packet can be sent to the packet receiving device through the data network, and then the packet is received. The receiving device processes the message.
  • the time recording module 102 in the message sending device may be implemented by a central processing unit (CPU, Central Processing Unit) and a digital signal processor (DSP, Digital Signal Processor) in the device. , a micro-control unit (MCU) or a field-programmable gate array (FPGA); the message sending module 103 in the message sending device can pass the communication module in practical applications. (including: basic communication suite, operating system, communication module, standardized interface and protocol, etc.) and transceiver antenna implementation; the message generation module 101 in the message sending device can be used by the CPU, DSP, MCU or The FPGA is implemented or implemented by a communication module.
  • CPU Central Processing Unit
  • DSP Digital Signal Processor
  • MCU micro-control unit
  • FPGA field-programmable gate array
  • This embodiment further provides a message receiving apparatus.
  • the method includes:
  • the message receiving module 201 is configured to receive the message through the data network and the time stamp of the entry clock when the message enters the data network;
  • the time determining module 202 is configured to determine an output moment of the packet according to the timestamp and the preset maximum delay.
  • the message buffering module 203 is configured to cache the message if the time point of the egress clock is less than the output time, wherein the egress clock is synchronized with the ingress clock.
  • the message receiving module 201 receives the message transmitted through the data network; the message transmission time is not determined, that is, the time of transmission and the arrival time of the message are not determined, which is due to the data.
  • the network itself does not have a certain transmission time.
  • the timestamp is the time of the entry clock when the message enters the data network.
  • the timestamp and the packet combination are sent through the data network, that is, the timestamp and the message arrive at the message receiving module 201 at the same time; the reason for the combination is to prevent the message and the timestamp from being simultaneously reported.
  • the text receiving module 201 causes trouble in comparison.
  • the implementation of the embodiment does not have much influence.
  • the preset maximum delay and the time point of the exit clock are also included.
  • the time point of the exit clock is the time indicated by the exit clock.
  • the exit clock is similar to the entrance clock. Its accuracy can be very high, for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, etc. The higher the accuracy, the more accurate the message delivery time.
  • the output is expected to be delayed; in this embodiment, the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like.
  • the accuracy of the exit clock may be the same as the accuracy of the entry clock.
  • the time determining module 202 is configured to calculate a sum of the timestamp and the preset maximum delay, and determine that the output time of the packet is greater than or equal to the timestamp and the preset maximum The sum of the delays.
  • the output time refers to a time point, and the message is allowed to output at a time point that satisfies the sum of the time stamp equal to or greater than the preset maximum time, and is also allowed to satisfy the time greater than the sum of the time stamp and the preset maximum time. Point output; although the output time is a time point, it does not mean that the message will be output at this moment. In fact, the output time is the earliest time point at which the message is allowed to be output, that is, a time point, which can be guaranteed. The message can be sent from the transmission to the output for a fixed period of time and this fixed time is as short as possible, ensuring efficiency.
  • the preset maximum delay is also mentioned above. Since the time for transmitting the packet in the data network is not fixed, in this embodiment, a fixed preset maximum delay is set, and the time between sending and output of the packet is determined by the preset maximum delay. It is fixed, and the fixed transmission time is the preset maximum delay.
  • the preset maximum delay is a preset time for delaying the message for a fixed period of time. Generally speaking, although the transmission time of the packets transmitted in the data network is not fixed, there is usually a maximum transmission time, that is, the maximum delay time. In the normal transmission process, the message does not exceed this maximum. The delay time, the transmission time is less than this maximum delay time.
  • the maximum delay time is generally experimental data, that is, a value determined by multiple sampling, from the message transmitting device to the message receiving device, under normal circumstances, the delay time of the message is not exceeded at most.
  • the preset maximum delay in this embodiment generally refers to the maximum delay time, such that The time that the packet is transmitted in the data network does not exceed the preset maximum delay. Therefore, the time from the transmission to the output can be fixed, reducing or not causing fluctuations, and the transmission of the packet is more stable.
  • the preset maximum delay can also be adjusted according to the needs, as long as it is within a reasonable range.
  • the exit clock since the timestamp is the time of the entry clock, the exit clock should be synchronized with the entry clock; the meaning of the synchronization is that the time of the entry clock and the exit clock are consistent, or the time of the entry clock and the time of the exit clock The conversion relationship between them is deterministic.
  • the synchronization mode between the egress clock and the ingress clock may include multiple types.
  • the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock. That is, the egress clock corresponding to the egress clock is aligned with the egress clock, or the egress clock corresponding to the ingress clock is consistent with the entry clock, based on the egress clock/ingress clock;
  • the absolute time of the two clocks is not necessarily accurate, but has no effect on the implementation of the embodiment, as long as the time synchronization between the two is sufficient; the second is that both the exit clock and the entry clock are synchronized with the reference clock, that is,
  • a third-party standard clock is used as a reference, and is recorded as a reference clock, so that both the egress clock and the ingress clock are synchronized with the reference clock, and accordingly, the egress clock and the ingress clock are synchronized.
  • the synchronization method may include: GPS,
  • the message caching module 203 buffers the message.
  • the time point of the egress clock is not only the time when the packet arrives at the packet receiving module 201, and the time point of the egress clock refers to the time indicated on the egress clock; The indicated time is always elapsed. Therefore, when the time point of the exit clock is less than the output time, the comparison should be continued.
  • the device further includes a message output module 204 configured to output the report when the time point of the exit clock is less than the output time, when the output time is reached at the time of the exit clock If the time point of the exit clock is greater than or equal to the output time, the message is directly output. Specifically, when the time of the exit clock is less than the output time, the output time is the time of the true outward output of the message; when the time of the exit clock is greater than the output time, the message can be directly output.
  • the time point of the exit clock or the time difference between the time and the time stamp of the exit clock is the time when the message is transmitted in the data network. . It can be seen from the foregoing that this time is not fixed, and it is often floating. Therefore, this embodiment provides the concept of preset maximum delay; if the time point of the exit clock is always smaller than the output time, the report is The text cache module 203 always caches the message. During the buffering period, the time point of the exit clock will be closer to the output time, and when the time point of the exit clock is equal to the output time, the message output module 204 can output the message.
  • the message output module 204 further includes a second encapsulating module 2041, configured to remove the timestamp from the packet when the timestamp is encapsulated in the packet, The message is repackaged and output.
  • Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
  • the outputted message can be output to the desired place to achieve the desired function; in this embodiment, the time elapsed from the transmission of the message to the output is consistent, in other words, as long as the message is transmitted.
  • the sequence of the messages is set in sequence, it can ensure that when the message is output, it is also output according to the preset timing.
  • the timing between two messages is set. After the data network is transmitted, if the first message is received later, the message will be sent first.
  • the buffer is not satisfied by the requirement of the output time, so that the first transmitted message can still be output first; and the message transmitting device sends the timed message to different message receiving devices, and the same can be performed. It ensures that the timing when the message is sent is consistent with the timing at the time of receiving, making the user's operation easier and more reliable.
  • the time determining module 202 in the message receiving device is in an actual application. It can be implemented by a CPU, a DSP, an MCU or an FPGA in the device; the message receiving module 201 in the message receiving device can pass through a communication module (including: basic communication suite, operating system, communication) in practical applications. The module, the standardized interface and the protocol, and the transmitting and receiving antennas are implemented; the message buffering module 203 in the message sending device can be implemented in a memory in an actual application.
  • a communication module including: basic communication suite, operating system, communication
  • the embodiment provides a message processing system, including the above-mentioned message sending device and message receiving device, wherein:
  • the message sending device is configured to obtain a message; record a timestamp of an entry clock when the message enters the data network; wherein the entry clock is synchronized with an exit clock; and the timestamp is sent through the data network Transmitting the message to the message receiving device;
  • the packet receiving device is configured to receive a packet through a data network and a timestamp of an entry clock when the packet enters the data network; and determine the packet according to the timestamp and a preset maximum delay. Output time; when the time point of the exit clock is less than the output time, the message is buffered, and the exit clock is synchronized with the entry clock.
  • the packet sending apparatus is configured to insert the time stamp into the packet, re-encapsulate the packet, and send the re-encapsulated packet through the data network. .
  • the packet receiving apparatus is configured to calculate a sum of the timestamp and the preset maximum delay, and determine that the output time of the packet is greater than or equal to the timestamp and the preset maximum The sum of the delays.
  • the message receiving apparatus is configured to output the message when the time point of the egress clock is greater than or equal to the output time.
  • the packet receiving apparatus is configured to remove the timestamp from the packet when the timestamp is encapsulated into the packet, and re-encapsulate the packet. And output.
  • the packet sending apparatus and the packet receiving apparatus may specifically refer to The description of the foregoing embodiment is not repeated here; the composition of the packet sending apparatus may be specifically shown in FIG. 4; the composition of the packet receiving apparatus may be specifically shown in FIG. 5.
  • the embodiment provides a packet processing method. Referring to FIG. 6, the method includes:
  • the packet may be generated by the packet generating module 101, and may not be generated by the packet generating module 101 itself, or may be sent by other devices to the packet sending device; the packet sending module 103 is The message passes through the starting point of the data network, and the message enters the data network in the message sending module 103.
  • S402. Record a timestamp of the entry clock when the packet enters the data network, and insert the timestamp into the packet; wherein the entry clock is synchronized with the exit clock.
  • the manner of synchronizing the ingress clock and the egress clock may include multiple types.
  • the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock, that is, the egress clock. Taking the entry clock as a reference, making the entry clock corresponding to the exit clock coincide with the exit clock, or making the exit clock corresponding to the entry clock coincide with the entry clock; thus the result of the synchronization is two clocks
  • the absolute time is not necessarily accurate, but has no effect on the implementation of the embodiment.
  • the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock.
  • the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
  • the timestamp of the packet entering the data network is recorded, the timestamp is inserted into the packet, and the packet is re-encapsulated. This ensures that the message and its corresponding timestamp will arrive at the message receiving device at the same time.
  • the packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated.
  • the re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the CRC of the packet. Bytes, etc.
  • the encapsulated packet can be sent to the packet receiving device through the data network, and then the packet receiving device processes the packet.
  • the received message is a message transmitted through the data network; the message transmission time is not determined, that is, the time of transmission and the arrival time of the message are not determined, because the data network itself does not have a certain transmission time. .
  • the time point of the egress clock is less than the output time, or the difference between the time point of the egress clock and the timestamp is less than the preset maximum delay. Then, the time point of the egress clock is not satisfied with the output time; if it is not satisfied, the pair is The message is cached.
  • Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
  • the disclosed method and apparatus may be implemented in other manners.
  • the device embodiments described above are merely illustrative.
  • the division of the modules is only a logical function division, and the actual implementation may have another The way of dividing, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed.
  • the communication connections between the various components shown or discussed may be indirect coupling or communication connections through some interfaces, devices or modules, and may be electrical, mechanical or otherwise.
  • the modules described above as separate components may or may not be physically separated.
  • the components displayed as modules may or may not be physical modules, that is, may be located in one place or distributed to multiple network modules; Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
  • each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may be separately used as one module, or two or more modules may be integrated into one module;
  • the module can be implemented in the form of hardware or in the form of hardware plus software function modules.
  • the foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium includes: a removable storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and the like, which can store program codes.
  • ROM read-only memory
  • the above-described integrated module of the embodiment of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product.
  • the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions.
  • a computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention.
  • the foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a ROM, a magnetic disk, or an optical disk.
  • the technical solution of the embodiment of the present invention overcomes the problem that the output of the packet is uncertain due to the uncertainty of the time of transmission of the packet in the data network, so that the packet can be transmitted according to a fixed time, which facilitates subsequent processing. Expanded the application range of the data network and improved the user experience.

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

Disclosed in the embodiments of the present invention are a message processing method, device, and system, and a computer storage medium. The message processing method comprises: obtaining a message, and recording the time stamp of the inlet clock when said message enters a data network, said inlet clock being synchronized to an outlet clock; sending the time stamp and the message by means of said data network.

Description

一种报文处理方法、装置、系统和计算机存储介质Message processing method, device, system and computer storage medium 技术领域Technical field
本发明涉及数据报文传送领域,尤其涉及一种报文处理方法、装置、系统和计算机存储介质。The present invention relates to the field of data message transmission, and in particular, to a message processing method, apparatus, system, and computer storage medium.
背景技术Background technique
以太网技术的快速发展,使得数据业务成为网络的主要业务流量,数据网络开始代替同步数字体系(SDH,Synchronous Digital Hierarchy)网络成为通讯网的发展方向,目前各个运营商大力发展分组传送网(PTN,Packet Transport Network)、无线接入网IP化(IPRAN,IP Radio Access Network)等数据网络,逐步替代SDH网络。数据网络具备综合成本低、业务调度能力灵活,很好地满足了当前数据业务的传送需求。但数据网络在业务传送中延迟时间、延迟时间抖动方面都存在不确定性,而在某些领域,对于数据报文的传送时长并不敏感,但对报文传递时间的变化非常敏感,例如,在电力系统通讯专网中,控制中心需要向上下游的两个电站下发电闸开关命令,要求命令传递时间是确定,保证上下游电闸开关按照指令顺序关系操作电闸开关,上下游电闸的开关顺序是有严格要求的,错误的电闸顺序会导致电网电力动作出现紊乱,酿成灾难。由于数据网络的报文传递时间不确定,因此无法满足电力专网的需求。The rapid development of Ethernet technology has made data services the main traffic of the network. The data network has begun to replace the Synchronous Digital Hierarchy (SDH) network as the development direction of the communication network. At present, various operators have vigorously developed the packet transmission network (PTN, Packet Transport Network), IPRAN (IP Radio Access Network) and other data networks gradually replace the SDH network. The data network has low comprehensive cost and flexible service scheduling capability, which satisfies the transmission requirements of current data services. However, data networks have uncertainties in delay time and delay time jitter in service transmission. In some areas, they are not sensitive to the transmission duration of data packets, but are very sensitive to changes in message delivery time. For example, In the power system communication private network, the control center needs to make the power generation switch command of the two power stations upstream and downstream, and the command transmission time is determined to ensure that the upstream and downstream electric switch operates the electric switch according to the command sequence relationship, and the switching sequence of the upstream and downstream electric switches There are strict requirements, and the wrong order of the electric gate will cause disorder of the power operation of the grid, causing disaster. Due to the uncertain message delivery time of the data network, the demand for the power private network cannot be met.
发明内容Summary of the invention
本发明实施例期望提供一种报文处理方法、装置、系统和计算机存储介质,旨在解决现有技术中数据报文传递时间不稳定,进而导致安全隐患等问题。 The embodiments of the present invention are directed to a packet processing method, apparatus, system, and computer storage medium, which are intended to solve the problem that the data packet transmission time is unstable in the prior art, thereby causing security risks and the like.
为了解决上述技术问题,本发明实施例提供了一种报文发送方法,包括:In order to solve the above technical problem, an embodiment of the present invention provides a packet sending method, including:
获得报文;Obtain a message;
记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;Recording a timestamp of the entry clock when the packet enters the data network; wherein the entry clock is synchronized with the exit clock;
通过所述数据网络发送所述时间戳与所述报文。Transmitting the timestamp and the message through the data network.
作为一种实施方式,所述通过所述数据网络发送所述时间戳与所述报文包括:将所述时间戳插入到所述报文中;对所述报文重新进行封装;通过所述数据网络发送重新封装后的报文。As an implementation manner, the sending, by the data network, the timestamp and the packet includes: inserting the timestamp into the packet; re-encapsulating the packet; The data network sends the repackaged message.
本发明实施例还提供了一种报文接收方法,包括:The embodiment of the invention further provides a packet receiving method, including:
通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;Receiving a message through the data network and a timestamp of the entry clock when the message enters the data network;
根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;Determining an output moment of the packet according to the timestamp and a preset maximum delay;
当出口时钟的时间点小于所述输出时刻时,则对所述报文进行缓存,其中,所述出口时钟与所述入口时钟同步。When the time point of the egress clock is less than the output time, the message is buffered, wherein the egress clock is synchronized with the entry clock.
作为一种实施方式,所述根据所述时间戳以及预设最大时延,确定所述报文的输出时刻包括:计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。As an implementation manner, determining the output moment of the packet according to the timestamp and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report The output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay.
作为一种实施方式,当所述出口时钟的时间点大于等于所述输出时刻时,所述方法还包括:输出所述报文。As an implementation manner, when the time point of the exit clock is greater than or equal to the output time, the method further includes: outputting the message.
作为一种实施方式,当所述时间戳被封装入所述报文时,所述输出所述报文包括:将所述时间戳从所述报文中移除;对所述报文重新进行封装并输出。As an embodiment, when the timestamp is encapsulated into the packet, the outputting the packet includes: removing the timestamp from the packet; and re-performing the packet Package and output.
本发明实施例还提供了一种报文处理方法,包括:The embodiment of the invention further provides a packet processing method, including:
获得报文; Obtain a message;
记录所述报文进入数据网络时、入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;Recording a timestamp of the entry clock when the packet enters the data network; wherein the entry clock is synchronized with the exit clock;
将所述时间戳与所述报文组合通过所述数据网络发送;Transmitting the timestamp and the message packet through the data network;
通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;Receiving a message through the data network and a timestamp of the entry clock when the message enters the data network;
根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;Determining an output moment of the packet according to the timestamp and a preset maximum delay;
当出口时钟的时间点小于所述输出时刻时,则对所述报文进行缓存,其中,所述出口时钟与所述入口时钟同步。When the time point of the egress clock is less than the output time, the message is buffered, wherein the egress clock is synchronized with the entry clock.
作为一种实施方式,所述通过所述数据网络发送所述时间戳与所述报文包括:将所述时间戳插入到所述报文中;对所述报文重新进行封装,并通过所述数据网络发送重新封装后的报文。As an implementation manner, the sending, by the data network, the timestamp and the packet includes: inserting the timestamp into the packet; re-encapsulating the packet, and passing the The data network sends the repackaged message.
作为一种实施方式,所述根据所述时间戳以及预设最大时延,确定所述报文的输出时刻包括:计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。As an implementation manner, determining the output moment of the packet according to the timestamp and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report The output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay.
作为一种实施方式,当所述出口时钟的时间点大于等于所述输出时刻时,所述方法还包括:则输出所述报文。As an implementation manner, when the time point of the exit clock is greater than or equal to the output time, the method further includes: outputting the message.
作为一种实施方式,当所述时间戳被封装入所述报文时,所述输出所述报文包括:将所述时间戳从所述报文中移除;对所述报文重新进行封装并输出。As an embodiment, when the timestamp is encapsulated into the packet, the outputting the packet includes: removing the timestamp from the packet; and re-performing the packet Package and output.
本发明实施例还提供了一种报文发送装置,包括:The embodiment of the invention further provides a message sending device, comprising:
报文生成模块,配置为获得报文;a packet generation module configured to obtain a packet;
时间记录模块,配置为记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;a time recording module configured to record a timestamp of an entry clock when the packet enters the data network; wherein the entry clock is synchronized with an exit clock;
报文发送模块,配置为通过所述数据网络发送所述时间戳与所述报文。The message sending module is configured to send the timestamp and the message through the data network.
作为一种实施方式,所述报文发送模块包括第一封装模块,配置为将 所述时间戳插入到所述报文中,对所述报文重新进行封装。As an implementation manner, the packet sending module includes a first encapsulating module configured to The timestamp is inserted into the packet, and the packet is re-encapsulated.
本发明实施例还提供了一种报文接收装置,包括:The embodiment of the invention further provides a message receiving device, comprising:
报文接收模块,配置为通过数据网络接收报文以及与所述报文进入所述数据网络时入口时钟的时间戳;a message receiving module, configured to receive a message through the data network and a timestamp of an entry clock when the message enters the data network;
时间确定模块,配置为根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;a time determining module, configured to determine an output moment of the packet according to the timestamp and a preset maximum delay;
报文缓存模块,配置为当出口时钟的时间点小于所述输出时刻时,对所述报文进行缓存,其中,所述出口时钟与所述入口时钟同步。The message cache module is configured to cache the message when the time point of the egress clock is less than the output time, wherein the egress clock is synchronized with the entry clock.
作为一种实施方式,所述时间确定模块,配置为计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和In an embodiment, the time determining module is configured to calculate a sum of the timestamp and the preset maximum delay, and determine that an output time of the packet is greater than or equal to the timestamp and the preset maximum Sum of delay
作为一种实施方式,所述装置还包括报文输出模块,配置为当所述出口时钟的时间点大于等于所述输出时刻时,输出所述报文。In an embodiment, the device further includes a message output module configured to output the message when a time point of the exit clock is greater than or equal to the output time.
作为一种实施方式,当所述时间戳被封装入所述报文时,所述报文输出模块包括第二封装模块,配置为将所述时间戳从所述报文中移除,对所述报文重新进行封装并输出。As an embodiment, when the timestamp is encapsulated into the packet, the packet output module includes a second encapsulating module, configured to remove the timestamp from the packet, The message is repackaged and output.
本发明实施例还提供了一种报文处理系统,包括报文发送装置和报文接收装置;The embodiment of the invention further provides a message processing system, including a message sending device and a message receiving device;
所述报文发送装置,配置为获得报文;记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;通过所述数据网络发送所述时间戳与所述报文至所述报文接收装置;The message sending device is configured to obtain a message; record a timestamp of an entry clock when the message enters the data network; wherein the entry clock is synchronized with an exit clock; and the timestamp is sent through the data network Transmitting the message to the message receiving device;
所述报文接收装置,配置为通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;当出口时钟的时间点小于所述输出时刻时,则对所述报文进行缓存,所述出口时钟与所述入口时钟同步。 The packet receiving device is configured to receive a packet through a data network and a timestamp of an entry clock when the packet enters the data network; and determine the packet according to the timestamp and a preset maximum delay. Output time; when the time point of the exit clock is less than the output time, the message is buffered, and the exit clock is synchronized with the entry clock.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例所述的应用于报文发送装置中的报文发送方法。The embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the application in the message sending apparatus according to the embodiment of the present invention. Message sending method.
本发明实施例还提供了一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行本发明实施例所述的应用于报文接收装置中的报文接收方法。The embodiment of the present invention further provides a computer storage medium, where the computer storage medium stores computer executable instructions, and the computer executable instructions are used to execute the application in the message receiving apparatus according to the embodiment of the present invention. Message receiving method.
本发明实施例提供的报文处理方法、装置、系统及计算机存储介质,数据发送装置获得报文,记录报文进入数据网络时入口时钟的时间戳,通过所述数据网络发送所述时间戳和所述报文;数据接收装置通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳,根据所述时间戳以及预设最大时延,确定报文的输出时刻,当出口时钟的时间点小于所述输出时刻,则对报文进行缓存。本实施例的技术方案克服了由于报文在数据网络中传输的时间不确定而导致的报文输出不确定的问题,使报文可以按照固定的时间进行传输,为后续的处理提供便利,扩大了数据网络的应用范围,提升了用户体验。The packet processing method, device, system, and computer storage medium provided by the embodiment of the present invention, the data sending device obtains a packet, records a timestamp of the entry clock when the packet enters the data network, and sends the timestamp through the data network. And the data receiving device receives the packet and the timestamp of the entry clock when the packet enters the data network, and determines the output time of the packet according to the timestamp and the preset maximum delay. When the time point of the exit clock is less than the output time, the message is buffered. The technical solution of the embodiment overcomes the problem that the message output is indeterminate due to the time uncertainty of the transmission of the message in the data network, so that the message can be transmitted according to a fixed time, which facilitates subsequent processing and expands The application range of the data network has improved the user experience.
附图说明DRAWINGS
图1是本发明实施例提供的一种报文发送方法流程图;FIG. 1 is a flowchart of a method for sending a message according to an embodiment of the present invention;
图2是本发明实施例提供的一种报文接收方法流程图;2 is a flowchart of a method for receiving a message according to an embodiment of the present invention;
图3是本发明实施例提供的一种报文处理方法流程图;FIG. 3 is a flowchart of a packet processing method according to an embodiment of the present invention;
图4是本发明实施例提供的一种报文发送装置模块示意图;4 is a schematic diagram of a packet sending apparatus module according to an embodiment of the present invention;
图5是本发明实施例提供的一种报文接收装置模块示意图;FIG. 5 is a schematic diagram of a packet receiving apparatus module according to an embodiment of the present invention; FIG.
图6是本发明实施例提供的一种报文处理方法流程图。FIG. 6 is a flowchart of a packet processing method according to an embodiment of the present invention.
具体实施方式detailed description
本发明实施例通过记录报文通过数据网络传输时,进入数据网络的时 间戳,以及设定预设最大时延,使报文在传输到报文接收装置时,在满足输出时刻的情况下才能输出,从而避免了报文在未加限制的情况下进行传输导致的传输时间不确定的问题,报文必须延迟预设最大时延这一时长,方便后续的操作以及扩大了数据网络的应用范围。When the packet is transmitted through the data network, the embodiment of the present invention enters the data network. The interval stamp and the preset maximum delay are such that when the message is transmitted to the message receiving device, the output can be output only when the output time is satisfied, thereby avoiding the message being transmitted without restriction. If the transmission time is uncertain, the message must be delayed by the preset maximum delay, which facilitates subsequent operations and expands the application range of the data network.
下面结合附图对本发明各个实施例作进一步说明。The various embodiments of the present invention are further described below in conjunction with the accompanying drawings.
本实施例提供了一种报文发送方法,所述报文发送方法可应用于报文发送装置中。参考图1,包括:The embodiment provides a packet sending method, and the packet sending method can be applied to a packet sending apparatus. Referring to Figure 1, including:
S101、获得报文;S101. Obtain a message;
S102、记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;S102. Record a timestamp of an entry clock when the packet enters the data network, where the entry clock is synchronized with an exit clock.
S103、通过所述数据网络发送所述时间戳与所述报文。S103. Send the timestamp and the packet by using the data network.
本实施例S101中,所述报文可由所述报文发送装置生成,但不一定是所述报文发送装置本身生成的,也可以是其他装置生成后发送给所述报文发送装置的。所述报文发送装置是报文通过数据网络发送的起点,报文在报文发送装置进入数据网络。In the embodiment S101, the message may be generated by the message sending device, but not necessarily generated by the message sending device itself, or may be sent to the message sending device after being generated by another device. The message sending device is a starting point for the message to be sent through the data network, and the message enters the data network in the message sending device.
本实施例S102中,由于报文发送装置要将报文通过数据网络发送,而报文发送装置是数据网络的起点;在发送所述报文时,记录下所述报文进入数据网络时、入口时钟的时间戳,所述时间戳与所述报文对应。作为一种实施方式,在报文进入数据网络的位置设置入口时钟,也即在所述报文发送装置的输出端口处设置入口时钟,所述入口时钟用于实时记录报文进入数据网络的时间。In the embodiment S102, the message sending device sends the message through the data network, and the message sending device is the starting point of the data network; when the message is sent, when the message is entered into the data network, A timestamp of the entry clock, the timestamp corresponding to the message. As an implementation manner, an entry clock is set at a location where the packet enters the data network, that is, an entry clock is set at an output port of the packet sending device, and the entry clock is used to record the time when the packet enters the data network in real time. .
其中,所述入口时钟的记录精度可以很高,可以精确到报文进入数据网络的瞬间,即记录下当时的时间;例如可精确到秒、毫秒、微妙,甚至皮秒、纳秒等等;精度越高,传递时间的波动就越小。本实施中对于时钟的形式,或者说原理没有限定,不管是机械钟,还是电子钟,石英钟,原 子钟等等,都是可行的。The recording precision of the entry clock can be very high, and can be accurate to the moment when the message enters the data network, that is, the time at which the time is recorded; for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, and the like; The higher the accuracy, the smaller the fluctuation in transit time. In this implementation, there is no limitation on the form or principle of the clock, whether it is a mechanical clock, an electronic clock, a quartz clock, or the original Zizhong, etc., are all feasible.
由于需要记录报文发送装置发送报文的时间,以及报文接收装置接收报文的时间,那么,所述报文发送装置的入口时钟和所述报文接收装置的出口时钟的时间应该同步;同步的含义是,入口时钟和出口时钟的时间是一致的,或者入口时钟的时间和出口时钟的时间之间的换算关系是确定的。例如,北京所在的时区是东八区,东京所在的时区是东九区,那么,北京的时间与东京的时间之间就有一个小时的时差;因此,若报文发送装置处于北京,而报文接收装置处于东京,则记录的时间戳就应该加上一个小时,或者出口时钟的时间要减去一个小时,这样才能使入口时钟和出口时钟同步。The time of the entry of the message sending device and the time of the exit clock of the message receiving device should be synchronized, as the time required for the message sending device to transmit the message and the time at which the message receiving device receives the message are recorded; The meaning of synchronization is that the time of the entry clock and the exit clock are the same, or the conversion relationship between the time of the entry clock and the time of the exit clock is determined. For example, the time zone where Beijing is located is Dongba District, and the time zone where Tokyo is located is Dongjiu District. Then there is an hour difference between Beijing time and Tokyo time; therefore, if the message sending device is in Beijing, it is reported. If the text receiving device is in Tokyo, the time stamp of the record should be added by one hour, or the time of the exit clock should be subtracted by one hour, so that the entry clock and the exit clock can be synchronized.
其中,所述入口时钟和所述出口时钟的同步方式,可以包括多种;一般来说,时钟的同步方式分为两大类,其一,是出口时钟和入口时钟之间进行同步,即以出口时钟/入口时钟为基准,使所述出口时钟相对应的入口时钟与所述出口时钟一致,或者使所述入口时钟相对应的出口时钟与所述入口时钟一致;这样同步的结果是两个时钟的绝对时间并不一定准确,但对本实施例的实现没有影响;其二,是出口时钟和入口时钟均与基准时钟进行同步,即以一个第三方的标准的时钟为基准,记为基准时钟,使出口时钟和入口时钟均与所述基准时钟同步,相应的,出口时钟和入口时钟之间达成同步。具体的,同步的方式可以包括:全球定位系统(GPS,Global Positioning System)、网络时间协议(NTP,Network Time Protocol)、中国北斗卫星导航系统、原子钟、IEEE1588(网络测量和控制系统的精密时钟同步协议标准)等等任何同步的方式均可。The manner of synchronizing the ingress clock and the egress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is to synchronize between the egress clock and the ingress clock, that is, Taking an exit clock/ingress clock as a reference, the entry clock corresponding to the exit clock is coincident with the exit clock, or the exit clock corresponding to the entry clock is consistent with the entry clock; The absolute time of the clock is not necessarily accurate, but has no effect on the implementation of the embodiment. Second, the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock. The exit clock and the entry clock are both synchronized with the reference clock, and correspondingly, the synchronization between the exit clock and the entry clock is achieved. Specifically, the synchronization method may include: Global Positioning System (GPS), Network Time Protocol (NTP), China Beidou satellite navigation system, atomic clock, IEEE1588 (precision clock synchronization of network measurement and control system) Protocol standard) and so on any synchronization.
本实施例S103中,报文发送装置已经获取了与报文对应的时间戳;为了使所述时间戳能够被报文接收装置得知,因此,需要将所述时间戳和报文组合后通过数据网络发送。之所以要组合发送,是为了避免报文和时间 戳不能同时到达报文接收装置,从而给报文接收装置进行比对带来麻烦。但在其他实施方式中,即使时间戳与对应的报文未同时到达报文接收装置,对于本实施例的实现也不会有太大的影响。In this embodiment S103, the packet sending apparatus has acquired the timestamp corresponding to the packet; in order to enable the timestamp to be known by the packet receiving apparatus, the timestamp and the packet need to be combined and passed. Data network is sent. The reason for sending in combination is to avoid messages and time. The stamp cannot arrive at the message receiving device at the same time, thereby causing trouble for the message receiving device to perform the comparison. However, in other embodiments, even if the timestamp and the corresponding message do not arrive at the message receiving device at the same time, the implementation of the embodiment does not have much influence.
作为一种实施方式,在记录了报文进入数据网络的所述时间戳后,就将所述时间戳插入到所述报文中,这样可以保证报文和与其对应的时间戳会同时到达报文接收装置。具体的,所述时间戳可以插入报文中的多个位置中的任一位置,如报文头部、报文头部和有效内容之间,或者是报文的尾部均可。As an implementation manner, after the time stamp of the packet entering the data network is recorded, the time stamp is inserted into the packet, so that the packet and the corresponding time stamp arrive at the same time. Text receiving device. Specifically, the timestamp can be inserted into any of a plurality of locations in the packet, such as a packet header, a packet header, and a payload, or a trailer at the end of the packet.
报文在原始的内容中增加了时间戳这一数据,因此,通常需要对报文重新封装;所述重新封装,包括但不限于:重新计算报文长度内容、重新计算报文的循环冗余码校验(CRC,Cyclic Redundancy Code)校验字节等。再对报文进行重新封装之后,可以顺利的将封装后的报文通过数据网络发送给报文接收装置,再由报文接收装置对报文进行处理。The packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated. The re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the cyclic redundancy of the packet. Code check (CRC, Cyclic Redundancy Code) check byte, etc. After the packet is re-encapsulated, the encapsulated packet can be sent to the packet receiving device through the data network, and then the packet receiving device processes the packet.
本实施例还提供了一种报文接收方法,所述报文接收方法可应用于报文接收装置中。请参考图2,包括:The embodiment further provides a message receiving method, and the message receiving method can be applied to a message receiving device. Please refer to Figure 2, including:
S201、通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;S201. Receive a packet through a data network, and a timestamp of an entry clock when the packet enters the data network.
S202、根据时间戳以及预设最大时延,确定报文的输出时刻;S202. Determine, according to the timestamp and the preset maximum delay, an output moment of the packet.
S203、若出口时钟的时间点小于输出时刻,对报文进行缓存,其中,所述出口时钟和所述入口时钟同步。S203. If the time point of the egress clock is less than the output time, buffer the packet, where the egress clock is synchronized with the entry clock.
本实施例S201中,接收报文是通过数据网络传输的报文;报文传输时间并不是确定的,也即传输的时间和报文到达的时间都不是确定的,这是由于数据网络自身并没有一个确定的传输时间。而时间戳就是报文进入数据网络时,入口时钟的时间。In this embodiment, the received message is a packet transmitted through the data network; the packet transmission time is not determined, that is, the time of transmission and the arrival time of the packet are not determined, because the data network itself There is no fixed transmission time. The timestamp is the time of the entry clock when the message enters the data network.
作为一种实施方式,时间戳和报文组合通过数据网络发送的,即时间 戳和报文同时到达报文输出装置;之所以要组合发送,是为了避免报文和时间戳不能同时到达报文接收装置,从而给报文接收装置进行比对带来麻烦。但在其他实施方式中,即使时间戳与对应的报文未同时到达报文接收装置,对于本实施例的实现也不会有太大的影响。As an implementation manner, the timestamp and the packet combination are sent through the data network, that is, the time. The stamp and the message arrive at the message output device at the same time; the reason for the combination is to prevent the message and the time stamp from being able to reach the message receiving device at the same time, thereby causing trouble for the message receiving device to perform the comparison. However, in other embodiments, even if the timestamp and the corresponding message do not arrive at the message receiving device at the same time, the implementation of the embodiment does not have much influence.
本实施例S202中,除了接收到的报文对应的时间戳,所述报文接收装置中还具有预设最大时延以及出口时钟的时间点。出口时钟的时间点,即为出口时钟所提示的时间。出口时钟与入口时钟类似,它的精度可以很高,例如可精确到秒、毫秒、微妙,甚至皮秒、纳秒等等;精度越高,报文传递的时间就越精确,越能使报文以预期的时延输出;本实施例中对时钟的形式,或者说原理并没有限定,不管是机械钟,还是电子钟,石英钟,原子钟等等,都是可行的。其中,所述出口时钟的精度与所述入口时钟的精度可以相同。In the embodiment S202, in addition to the timestamp corresponding to the received message, the packet receiving apparatus further has a preset maximum delay and a time point of the exit clock. The time point of the exit clock is the time indicated by the exit clock. The exit clock is similar to the entrance clock. Its accuracy can be very high, for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, etc. The higher the accuracy, the more accurate the message delivery time. The output is expected to be delayed; in this embodiment, the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like. The accuracy of the exit clock may be the same as the accuracy of the entry clock.
本实施例中,所述根据与报文对应的时间戳以及预设最大时延,确定报文的输出时刻包括:计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。输出时刻指的是一个时间点,报文被允许在满足大于等于时间戳与预设最大时间之和的这一时间点输出,也被允许在满足大于时间戳与预设最大时间之和的时间点输出;输出时刻虽然是一个时间点,但并不意味着报文一定会在这一时刻输出,事实上,输出时刻是报文允许被输出的最早时间点,即一种时间点,可以保证报文从发送到输出能够经过一段固定的时间且这个固定的时间还尽可能的短,保证了效率。In this embodiment, determining the output time of the packet according to the timestamp corresponding to the packet and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report. The output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay. The output time refers to a time point, and the message is allowed to output at a time point that satisfies the sum of the time stamp equal to or greater than the preset maximum time, and is also allowed to satisfy the time greater than the sum of the time stamp and the preset maximum time. Point output; although the output time is a time point, it does not mean that the message will be output at this moment. In fact, the output time is the earliest time point at which the message is allowed to be output, that is, a time point, which can be guaranteed. The message can be sent from the transmission to the output for a fixed period of time and this fixed time is as short as possible, ensuring efficiency.
上面还提到了预设最大时延。由于报文在数据网络中传输的时间并不固定,因此,本实施例中设定了固定的预设最大时延,通过这个预设最大时延使得报文从发送到输出之间的时间是固定的,该固定的传输时间即为预设最大时延。所述预设最大时延就是一种预设的、使报文延迟固定时长 的时间。通常来说,虽然数据网络中传输的报文其传输时间并不固定,但一般会有一个传输时间的最大值,即最大延迟时间;而在正常的传输过程中,报文不会超过这个最大延迟时间,传输的时间都是小于这个最大延迟时间的。所述最大延迟时间一般是实验数据,即通过多次采样确定,从报文发送装置到报文接收装置,在正常情况下,报文的延迟时间最大不超过的数值。本实施例中的预设最大时延,一般指的是最大延迟时间,这样,报文在数据网络中传输的时间不会超过该预设最大时延,因此,就能将报文从发送到输出这段时间固定下来,减少甚至不产生波动,使报文的传输更加稳定。当然,预设最大时延也可以根据需求进行调整,只要其在合理的范围内即可。The preset maximum delay is also mentioned above. Since the time for transmitting the packet in the data network is not fixed, in this embodiment, a fixed preset maximum delay is set, and the time between sending and output of the packet is determined by the preset maximum delay. Fixed, the fixed transmission time is the preset maximum delay. The preset maximum delay is a preset time delay for the message to be fixed. time. Generally speaking, although the transmission time of the packets transmitted in the data network is not fixed, there is usually a maximum transmission time, that is, the maximum delay time. In the normal transmission process, the message does not exceed this maximum. The delay time, the transmission time is less than this maximum delay time. The maximum delay time is generally experimental data, that is, a value determined by multiple sampling, from the message transmitting device to the message receiving device, under normal circumstances, the delay time of the message is not exceeded at most. The preset maximum delay in this embodiment generally refers to the maximum delay time, so that the time that the packet is transmitted in the data network does not exceed the preset maximum delay, so that the packet can be sent from the The output period is fixed, reducing or not causing fluctuations, making the transmission of the message more stable. Of course, the preset maximum delay can also be adjusted according to the needs, as long as it is within a reasonable range.
本实施例S203中,当出口时钟的时间点小于输出时刻时,对报文进行缓存。需要说明的是,出口时钟的时间点,并不只是报文到达报文接收装置那一瞬间的时间,所述出口时钟的时间点指的就是出口时钟上所提示的时间;由于出口时钟的所提示的时间是一直在流逝中的,因此,出口时钟的时间点小于输出时刻时,应该继续进行比对。若出口时钟的时间点小于输出时刻,则在出口时钟的时间点达到输出时刻时,可以输出报文;若出口时钟的时间点大于输出时刻,就可以直接输出报文。换言之,在出口时钟的时间点小于输出时刻时,输出时刻就是报文的真实向外输出的时间;在出口时钟的时间点大于输出时刻时,就可以直接输出报文。In the embodiment S203, when the time point of the exit clock is less than the output time, the message is buffered. It should be noted that the time point of the egress clock is not only the time when the packet arrives at the packet receiving device, and the time point of the egress clock refers to the time indicated on the egress clock; The reminder time is always elapsed. Therefore, when the time point of the exit clock is less than the output time, the comparison should be continued. If the time of the exit clock is less than the output time, the message can be output when the output clock reaches the output time; if the time of the exit clock is greater than the output time, the message can be directly output. In other words, when the time point of the exit clock is less than the output time, the output time is the time when the true output of the message is outward; when the time point of the exit clock is greater than the output time, the message can be directly output.
本实施例中,在报文刚刚到达报文接收装置时,显然,此时出口时钟的时间点,或者说出口时钟提示的时间与时间戳之差,就是报文在数据网络中传输的时间。由前述可知,这一时间并不是固定的,它是经常会浮动的,因此,本实施例提供了预设最大时延的概念;若出口时钟的时间点一直小于输出时刻,就一直对所述报文进行缓存。而在缓存期间,出口时钟的时间点会越来越接近输出时刻,而在出口时钟的时间点等于输出时刻时, 就可以输出该报文。In this embodiment, when the packet has just arrived at the packet receiving device, it is obvious that the time point of the egress clock or the difference between the elapsed clock prompt time and the time stamp is the time when the packet is transmitted in the data network. It can be seen from the foregoing that this time is not fixed, and it is often floating. Therefore, this embodiment provides the concept of preset maximum delay; if the time point of the exit clock is always smaller than the output time, the The message is cached. During the buffering, the time of the exit clock will be closer to the output time, and when the time of the exit clock is equal to the output time, The message can be output.
此外,由于时间戳是入口时钟的时间,因此,出口时钟应该和入口时钟同步;同步的含义是,入口时钟和出口时钟的时间是一致的,或者入口时钟的时间和出口时钟的时间之间的换算关系是确定的。In addition, since the timestamp is the time of the entry clock, the exit clock should be synchronized with the entry clock; the meaning of synchronization is that the time of the entry clock and the exit clock are the same, or between the time of the entry clock and the time of the exit clock. The conversion relationship is deterministic.
其中,所述出口时钟和所述入口时钟之间的同步方式,可以包括多种;一般来说,时钟的同步方式分为两大类,其一,是出口时钟和入口时钟之间进行同步,即以出口时钟/入口时钟为基准,使所述出口时钟相对应的入口时钟与所述出口时钟一致,或者使所述入口时钟相对应的出口时钟与所述入口时钟一致;这样同步的结果是两个时钟的绝对时间并不一定准确,但对本实施例的实现没有影响,只要这两者之间的时间同步即可;其二,是出口时钟和入口时钟均与基准时钟进行同步,即以一个第三方的标准的时钟为基准,记为基准时钟,使出口时钟和入口时钟均与所述基准时钟同步,相应的,出口时钟和入口时钟之间达成同步。具体的,同步的方式可以包括:GPS、NTP、中国北斗卫星导航系统、原子钟、IEEE1588等等任何同步的方式均可。The synchronization mode between the egress clock and the ingress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock. That is, the egress clock corresponding to the egress clock is aligned with the egress clock, or the egress clock corresponding to the ingress clock is consistent with the entry clock, based on the egress clock/ingress clock; The absolute time of the two clocks is not necessarily accurate, but has no effect on the implementation of the embodiment, as long as the time synchronization between the two is sufficient; the second is that both the exit clock and the entry clock are synchronized with the reference clock, that is, A third-party standard clock is used as a reference, and is recorded as a reference clock, so that both the egress clock and the ingress clock are synchronized with the reference clock, and accordingly, the egress clock and the ingress clock are synchronized. Specifically, the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
在输出报文时,若时间戳是封装在报文中的,则需要将报文中的时间戳移除,然后对报文进行重新封装再输出。重新封装包括但不限于:重新计算报文长度内容、重新计算报文的CRC校验字节等。If the timestamp is encapsulated in the packet, the timestamp in the packet is removed, and then the packet is re-encapsulated and output. Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
输出的报文可以输出到所需的地方,从而实现所需的功能;在本实施例中,可以使报文从发送到输出所经过的时间是一致的,换句话说,只要在发送报文时,对有时序的报文设置先后顺序,那就可以保证报文在输出时,其也是按照预设的时序进行输出的。对于同一个报文接收装置而言,在发送时,设置两个报文之间的时序,在经过数据网络的传送后,先发送的报文即使后接收,也会因为后发送的报文先到却没有满足输出时刻的要求而被缓存,就使得先发送的报文仍然能保证被先输出;而报文发送装置 将有时序的报文发送给不同的报文接收装置也是一样,同样能够保证报文发送时的时序与接收时的时序一致,从而使用户操作更加简便且可靠。The outputted message can be output to the desired place to achieve the desired function; in this embodiment, the time elapsed from the transmission of the message to the output is consistent, in other words, as long as the message is transmitted. When the sequence of the messages is set in sequence, it can ensure that when the message is output, it is also output according to the preset timing. For the same message receiving device, when transmitting, the timing between two messages is set. After the data network is transmitted, if the first message is received later, the message will be sent first. The buffer is buffered when it does not meet the requirements of the output time, so that the first transmitted message can still be guaranteed to be output first; and the message transmitting device The same is true for sending time-series messages to different message receiving devices. It is also possible to ensure that the timing of message transmission is consistent with the timing of reception, thereby making the user's operation easier and more reliable.
本实施例提供了一种报文处理方法,请参考图3,包括:This embodiment provides a packet processing method. Referring to FIG. 3, the method includes:
S301、获得报文;S301. Obtain a message.
S302、记录报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;S302. Record a timestamp of an entry clock when the packet enters the data network, where the entry clock is synchronized with the exit clock.
S303、报文发送装置通过所述数据网络发送所述时间戳与报文给报文接收装置;S303. The packet sending apparatus sends the timestamp and the packet to the packet receiving apparatus by using the data network.
S304、报文接收装置通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;S304. The packet receiving device receives the packet through the data network, and a timestamp of the entry clock when the packet enters the data network.
S305、根据时间戳以及预设最大时延确定报文的输出时刻;S305. Determine, according to the timestamp and the preset maximum delay, an output moment of the packet.
S306、若出口时钟的时间点小于所述输出时刻,对所述报文进行缓存,其中,所述出口时钟和所述入口时钟同步。S306. If the time point of the egress clock is less than the output time, buffer the packet, where the egress clock is synchronized with the entry clock.
本实施例S301中,所述报文可由所述报文发送装置生成,但不一定是所述报文发送装置本身生成的,也可以是其他装置生成后发送给所述报文发送装置的。所述报文发送装置是报文通过数据网络发送的起点,报文在报文发送装置这一点进入数据网络。In the embodiment S301, the message may be generated by the message sending device, but not necessarily generated by the message sending device itself, or may be sent to the message sending device after being generated by another device. The message sending device is a starting point for the message to be sent through the data network, and the message enters the data network at the point of the message sending device.
本实施例S302中,由于报文发送装置要将报文通过数据网络发送,而报文发送装置是数据网络的起点;在发送所述报文时,记录下所述报文进入数据网络时、入口时钟的时间戳,所述时间戳与所述报文对应。作为一种实施方式,在报文进入数据网络的位置设置入口时钟,也即在所述报文发送装置的输出端口处设置入口时钟,所述入口时钟用于实时记录报文进入数据网络的时间。In the embodiment S302, the message sending device sends the message through the data network, and the message sending device is the starting point of the data network; when the message is sent, when the message is entered into the data network, A timestamp of the entry clock, the timestamp corresponding to the message. As an implementation manner, an entry clock is set at a location where the packet enters the data network, that is, an entry clock is set at an output port of the packet sending device, and the entry clock is used to record the time when the packet enters the data network in real time. .
其中,所述入口时钟的记录精度可以很高,可以精确到报文进入数据网络的瞬间,即记录下当时的时间;例如可精确到秒、毫秒、微妙,甚至 皮秒、纳秒等等;精度越高,传递时间的波动就越小。本实施中对于时钟的形式,或者说原理没有限定,不管是机械钟,还是电子钟,石英钟,原子钟等等,都是可行的。The recording accuracy of the entry clock can be very high, and can be accurate to the moment when the message enters the data network, that is, the time at the time is recorded; for example, it can be accurate to seconds, milliseconds, subtle, or even Picoseconds, nanoseconds, etc.; the higher the precision, the smaller the fluctuation in transit time. In this implementation, the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like.
由于需要记录报文发送装置发送报文的时间,以及报文接收装置接收报文的时间,那么,所述报文发送装置的入口时钟和所述报文接收装置的出口时钟的时间应该同步;同步的含义是,入口时钟和出口时钟的时间是一致的,或者入口时钟的时间和出口时钟的时间之间的换算关系是确定的。例如,北京所在的时区是东八区,东京所在的时区是东九区,那么,北京的时间与东京的时间之间就有一个小时的时差;因此,若报文发送装置处于北京,而报文接收装置处于东京,则记录的时间戳就应该加上一个小时,或者出口时钟的时间要减去一个小时,这样才能使入口时钟和出口时钟同步。The time of the entry of the message sending device and the time of the exit clock of the message receiving device should be synchronized, as the time required for the message sending device to transmit the message and the time at which the message receiving device receives the message are recorded; The meaning of synchronization is that the time of the entry clock and the exit clock are the same, or the conversion relationship between the time of the entry clock and the time of the exit clock is determined. For example, the time zone where Beijing is located is Dongba District, and the time zone where Tokyo is located is Dongjiu District. Then there is an hour difference between Beijing time and Tokyo time; therefore, if the message sending device is in Beijing, it is reported. If the text receiving device is in Tokyo, the time stamp of the record should be added by one hour, or the time of the exit clock should be subtracted by one hour, so that the entry clock and the exit clock can be synchronized.
其中,所述入口时钟和所述出口时钟的同步方式,可以包括多种;一般来说,时钟的同步方式分为两大类,其一,是出口时钟和入口时钟之间进行同步,即以出口时钟/入口时钟为基准,使所述出口时钟相对应的入口时钟与所述出口时钟一致,或者使所述入口时钟相对应的出口时钟与所述入口时钟一致;这样同步的结果是两个时钟的绝对时间并不一定准确,但对本实施例的实现没有影响;其二,是出口时钟和入口时钟均与基准时钟进行同步,即以一个第三方的标准的时钟为基准,记为基准时钟,使出口时钟和入口时钟均与所述基准时钟同步,相应的,出口时钟和入口时钟之间所述同步。具体的,同步的方式可以包括:GPS、NTP、中国北斗卫星导航系统、原子钟、IEEE1588等等任何同步的方式均可。The manner of synchronizing the ingress clock and the egress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is to synchronize between the egress clock and the ingress clock, that is, Taking an exit clock/ingress clock as a reference, the entry clock corresponding to the exit clock is coincident with the exit clock, or the exit clock corresponding to the entry clock is consistent with the entry clock; The absolute time of the clock is not necessarily accurate, but has no effect on the implementation of the embodiment. Second, the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock. And causing both the exit clock and the entry clock to be synchronized with the reference clock, and correspondingly, the synchronization between the exit clock and the entry clock. Specifically, the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
本实施例S303中,报文发送装置已经获取了与报文对应的时间戳;为了使所述时间戳能够被报文接收装置得知,因此,需要将所述时间戳和报文组合后通过数据网络发送。之所以要组合发送,是为了避免报文和时间 戳不能同时到达报文接收装置,从而给报文接收装置进行比对带来麻烦。但在其他实施方式中,即使时间戳与对应的报文未同时到达报文接收装置,对于本实施例的实现也不会有太大的影响。In this embodiment S303, the packet sending apparatus has acquired the timestamp corresponding to the packet; in order to enable the timestamp to be known by the packet receiving apparatus, the timestamp and the packet need to be combined and passed. Data network is sent. The reason for sending in combination is to avoid messages and time. The stamp cannot arrive at the message receiving device at the same time, thereby causing trouble for the message receiving device to perform the comparison. However, in other embodiments, even if the timestamp and the corresponding message do not arrive at the message receiving device at the same time, the implementation of the embodiment does not have much influence.
作为一种实施方式,在记录了报文进入数据网络的所述时间戳后,就将所述时间戳插入到所述报文中,这样可以保证报文和与其对应的时间戳会同时到达报文接收装置。具体的,所述时间戳可以插入报文中的多个位置中的任一位置,如报文头部、报文头部和有效内容之间,或者是报文的尾部均可。As an implementation manner, after the time stamp of the packet entering the data network is recorded, the time stamp is inserted into the packet, so that the packet and the corresponding time stamp arrive at the same time. Text receiving device. Specifically, the timestamp can be inserted into any of a plurality of locations in the packet, such as a packet header, a packet header, and a payload, or a trailer at the end of the packet.
报文在原始的内容中增加了时间戳这一数据,因此,通常需要对报文重新封装;所述重新封装,包括但不限于:重新计算报文长度内容、重新计算报文的CRC校验字节等。再对报文进行重新封装之后,可以顺利的将封装后的报文通过数据网络发送给报文接收装置,再由报文接收装置对报文进行处理。The packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated. The re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the CRC of the packet. Bytes, etc. After the packet is re-encapsulated, the encapsulated packet can be sent to the packet receiving device through the data network, and then the packet receiving device processes the packet.
本实施例S304中,接收报文是通过数据网络传输的报文;报文传输时间并不是确定的,也即传输的时间和报文到达的时间都不是确定的,这是由于数据网络自身并没有一个确定的传输时间。而时间戳就是报文进入数据网络时,入口时钟的时间。In the embodiment S304, the received message is a packet transmitted through the data network; the packet transmission time is not determined, that is, the time of transmission and the arrival time of the packet are not determined, because the data network itself There is no fixed transmission time. The timestamp is the time of the entry clock when the message enters the data network.
作为一种实施方式,时间戳和报文组合通过数据网络发送的,即时间戳和报文同时到达报文输出装置;之所以要组合发送,是为了避免报文和时间戳不能同时到达报文接收装置,从而给报文接收装置进行比对带来麻烦。但在其他实施方式中,即使时间戳与对应的报文未同时到达报文接收装置,对于本实施例的实现也不会有太大的影响。As an implementation manner, the timestamp and the packet combination are sent through the data network, that is, the timestamp and the message arrive at the message output device at the same time; the reason for the combination is that the message and the timestamp cannot reach the message at the same time. Receiving the device, thereby causing trouble for the message receiving device to perform the comparison. However, in other embodiments, even if the timestamp and the corresponding message do not arrive at the message receiving device at the same time, the implementation of the embodiment does not have much influence.
本实施例S305中,除了接收到的报文对应的时间戳,所述报文接收装置中还具有预设最大时延以及出口时钟的时间点。出口时钟的时间点,即为出口时钟所提示的时间。出口时钟与入口时钟类似,它的精度可以很高, 例如可精确到秒、毫秒、微妙,甚至皮秒、纳秒等等;精度越高,报文传递的时间就越精确,越能使报文以预期的时延输出;本实施例中对时钟的形式,或者说原理并没有限定,不管是机械钟,还是电子钟,石英钟,原子钟等等,都是可行的。其中,所述出口时钟的精度与所述入口时钟的精度可以相同。In the embodiment S305, in addition to the timestamp corresponding to the received message, the packet receiving apparatus further has a preset maximum delay and a time point of the exit clock. The time point of the exit clock is the time indicated by the exit clock. The exit clock is similar to the entrance clock, and its accuracy can be very high. For example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, etc.; the higher the precision, the more accurate the message delivery time, and the more the message can be output with the expected delay; in this embodiment, the clock The form, or principle, is not limited, whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, etc., are all feasible. The accuracy of the exit clock may be the same as the accuracy of the entry clock.
本实施例中,所述根据与报文对应的时间戳以及预设最大时延,确定报文的输出时刻包括:计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。输出时刻指的是一个时间点,报文被允许在满足大于等于时间戳与预设最大时间之和的这一时间点输出,也被允许在满足大于时间戳与预设最大时间之和的时间点输出;输出时刻虽然是一个时间点,但并不意味着报文一定会在这一时刻输出,事实上,输出时刻是报文允许被输出的最早时间点,即一种时间点,可以保证报文从发送到输出能够经过一段固定的时间且这个固定的时间还尽可能的短,保证了效率。In this embodiment, determining the output time of the packet according to the timestamp corresponding to the packet and the preset maximum delay includes: calculating a sum of the timestamp and the preset maximum delay, and determining the report. The output moment of the text is greater than or equal to the sum of the timestamp and the preset maximum delay. The output time refers to a time point, and the message is allowed to output at a time point that satisfies the sum of the time stamp equal to or greater than the preset maximum time, and is also allowed to satisfy the time greater than the sum of the time stamp and the preset maximum time. Point output; although the output time is a time point, it does not mean that the message will be output at this moment. In fact, the output time is the earliest time point at which the message is allowed to be output, that is, a time point, which can be guaranteed. The message can be sent from the transmission to the output for a fixed period of time and this fixed time is as short as possible, ensuring efficiency.
上面还提到了预设最大时延。由于报文在数据网络中传输的时间并不固定,因此,本实施例中设定了固定的预设最大时延,通过这个预设最大时延使得报文从发送到输出之间的时间是固定的,该固定的传输时间即为预设最大时延。所述预设最大时延就是一种预设的、使报文延迟固定时长的时间。通常来说,虽然数据网络中传输的报文其传输时间并不固定,但一般会有一个传输时间的最大值,即最大延迟时间;而在正常的传输过程中,报文不会超过这个最大延迟时间,传输的时间都是小于这个最大延迟时间的。所述最大延迟时间一般是实验数据,即通过多次采样确定,从报文发送装置到报文接收装置,在正常情况下,报文的延迟时间最大不超过的数值。本实施例中的预设最大时延,一般指的是最大延迟时间,这样,报文在数据网络中传输的时间不会超过该预设最大时延,因此,就能将报 文从发送到输出这段时间固定下来,减少甚至不产生波动,使报文的传输更加稳定。当然,预设最大时延也可以根据需求进行调整,只要其在合理的范围内即可。The preset maximum delay is also mentioned above. Since the time for transmitting the packet in the data network is not fixed, in this embodiment, a fixed preset maximum delay is set, and the time between sending and output of the packet is determined by the preset maximum delay. Fixed, the fixed transmission time is the preset maximum delay. The preset maximum delay is a preset time for delaying the message for a fixed period of time. Generally speaking, although the transmission time of the packets transmitted in the data network is not fixed, there is usually a maximum transmission time, that is, the maximum delay time. In the normal transmission process, the message does not exceed this maximum. The delay time, the transmission time is less than this maximum delay time. The maximum delay time is generally experimental data, that is, a value determined by multiple sampling, from the message transmitting device to the message receiving device, under normal circumstances, the delay time of the message is not exceeded at most. The preset maximum delay in this embodiment generally refers to the maximum delay time, so that the time that the packet is transmitted in the data network does not exceed the preset maximum delay, and therefore, the packet can be reported. The time from the transmission to the output is fixed, reducing or not causing fluctuations, making the transmission of the message more stable. Of course, the preset maximum delay can also be adjusted according to the needs, as long as it is within a reasonable range.
本实施例S306中,当出口时钟的时间点小于输出时刻时,对报文进行缓存。需要说明的是,出口时钟的时间点,并不只是报文到达报文接收装置那一瞬间的时间,所述出口时钟的时间点指的就是出口时钟上所提示的时间;由于出口时钟的所提示的时间是一直在流逝中的,因此,出口时钟的时间点小于输出时刻时,应该继续进行比对。若出口时钟的时间点小于输出时刻,则在出口时钟的时间点达到输出时刻时,可以输出报文;若出口时钟的时间点大于输出时刻,就可以直接输出报文。换言之,在出口时钟的时间点小于输出时刻时,输出时刻就是报文的真实向外输出的时间;在出口时钟的时间点大于输出时刻时,就可以直接输出报文。In the embodiment S306, when the time point of the exit clock is less than the output time, the message is buffered. It should be noted that the time point of the egress clock is not only the time when the packet arrives at the packet receiving device, and the time point of the egress clock refers to the time indicated on the egress clock; The reminder time is always elapsed. Therefore, when the time point of the exit clock is less than the output time, the comparison should be continued. If the time of the exit clock is less than the output time, the message can be output when the output clock reaches the output time; if the time of the exit clock is greater than the output time, the message can be directly output. In other words, when the time point of the exit clock is less than the output time, the output time is the time when the true output of the message is outward; when the time point of the exit clock is greater than the output time, the message can be directly output.
本实施例中,在报文刚刚到达报文接收装置时,显然,此时出口时钟的时间点,或者说出口时钟提示的时间与时间戳之差,就是报文在数据网络中传输的时间。由前述可知,这一时间并不是固定的,它是经常会浮动的,因此,本实施例提供了预设最大时延的概念;若出口时钟的时间点一直小于输出时刻,就一直对该报文进行缓存。而在缓存期间,出口时钟的时间点会越来越接近输出时刻,而在出口时钟的时间点等于输出时刻时,就可以输出该报文。In this embodiment, when the packet has just arrived at the packet receiving device, it is obvious that the time point of the egress clock or the difference between the elapsed clock prompt time and the time stamp is the time when the packet is transmitted in the data network. It can be seen from the foregoing that this time is not fixed, and it is often floating. Therefore, this embodiment provides the concept of preset maximum delay; if the time point of the exit clock is always smaller than the output time, the report is always The text is cached. During the buffering period, the time point of the exit clock will be closer to the output time, and when the time point of the exit clock is equal to the output time, the message can be output.
此外,由于时间戳是入口时钟的时间,因此,出口时钟应该和入口时钟同步;同步的含义是,入口时钟和出口时钟的时间是一致的,或者入口时钟的时间和出口时钟的时间之间的换算关系是确定的。In addition, since the timestamp is the time of the entry clock, the exit clock should be synchronized with the entry clock; the meaning of synchronization is that the time of the entry clock and the exit clock are the same, or between the time of the entry clock and the time of the exit clock. The conversion relationship is deterministic.
其中,所述出口时钟和所述入口时钟之间的同步方式,可以包括多种;一般来说,时钟的同步方式分为两大类,其一,是出口时钟和入口时钟之间进行同步,即以出口时钟/入口时钟为基准,使所述出口时钟相对应的入 口时钟与所述出口时钟一致,或者使所述入口时钟相对应的出口时钟与所述入口时钟一致;这样同步的结果是两个时钟的绝对时间并不一定准确,但对本实施例的实现没有影响,只要这两者之间的时间同步即可;其二,是出口时钟和入口时钟均与基准时钟进行同步,即以一个第三方的标准的时钟为基准,记为基准时钟,使出口时钟和入口时钟均与所述基准时钟同步,相应的,出口时钟和入口时钟之间达成同步了。具体的,同步的方式可以包括:GPS、NTP、中国北斗卫星导航系统、原子钟、IEEE1588等等任何同步的方式均可。The synchronization mode between the egress clock and the ingress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock. That is, the exit clock/entry clock is used as a reference, and the exit clock is correspondingly entered. The port clock is consistent with the egress clock, or the egress clock corresponding to the ingress clock is consistent with the ingress clock; the result of the synchronization is that the absolute time of the two clocks is not necessarily accurate, but the implementation of the embodiment is not Impact, as long as the time synchronization between the two can be; second, the exit clock and the entry clock are synchronized with the reference clock, that is, based on a third-party standard clock, recorded as the reference clock, making the exit clock And the entry clock are both synchronized with the reference clock, and correspondingly, the synchronization between the exit clock and the entry clock is achieved. Specifically, the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
在输出报文时,若在发送报文时,将时间戳插入到所述报文中,并对报文进行重新封装,则需要将报文中的时间戳移除,然后对报文进行重新封装再输出。重新封装包括但不限于:重新计算报文长度内容、重新计算报文的CRC校验字节等。When the packet is output, if the timestamp is inserted into the packet and the packet is re-encapsulated, the timestamp in the packet needs to be removed, and then the packet is re-reconstructed. Package and then output. Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
输出的报文可以输出到所需的地方,从而实现所需的功能;在本实施例中,可以使报文从发送到输出所经过的时间是一致的,换句话说,只要在发送报文时,对有时序的报文设置先后顺序,那就可以保证报文在输出时,其也是按照预设的时序进行输出的。对于同一个报文接收装置而言,在发送时,设置两个报文之间的时序,在经过数据网络的传送后,先发送的报文即使后接收,也会因为后发送的报文先到却没有满足输出时刻的要求而被缓存,就使得先发送的报文仍然能保证被先输出;而报文发送装置将有时序的报文发送给不同的报文接收装置也是一样,同样能够保证报文发送时的时序与接收时的时序一致,从而使用户操作更加简便且可靠。The outputted message can be output to the desired place to achieve the desired function; in this embodiment, the time elapsed from the transmission of the message to the output is consistent, in other words, as long as the message is transmitted. When the sequence of the messages is set in sequence, it can ensure that when the message is output, it is also output according to the preset timing. For the same message receiving device, when transmitting, the timing between two messages is set. After the data network is transmitted, if the first message is received later, the message will be sent first. The buffer is not satisfied by the requirement of the output time, so that the first transmitted message can still be output first; and the message transmitting device sends the timed message to different message receiving devices, and the same can be performed. It ensures that the timing when the message is sent is consistent with the timing at the time of receiving, making the user's operation easier and more reliable.
本实施例提供了一种报文发送装置,请参考图4,包括:This embodiment provides a message sending apparatus. Referring to FIG. 4, the method includes:
报文生成模块101,配置为获得报文;The message generating module 101 is configured to obtain a message;
时间记录模块102,配置为记录报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步; The time recording module 102 is configured to record a timestamp of the entry clock when the packet enters the data network; wherein the entry clock is synchronized with the exit clock;
报文发送模块103,配置为通过所述数据网络发送所述时间戳与所述报文。The message sending module 103 is configured to send the timestamp and the message through the data network.
本实施例中,所述报文可由所述报文生成模块101生成,并不一定是报文生成模块101本身生成的,也可以是其他装置生成后发送给报文发送装置的;所述报文发送模块103是报文通过数据网络发送的起点,报文在报文发送模块103进入数据网络。In this embodiment, the packet may be generated by the packet generating module 101, and may not be generated by the packet generating module 101 itself, or may be sent to the packet sending device after being generated by other devices; The text sending module 103 is a starting point for sending a message through the data network, and the message enters the data network in the message sending module 103.
本实施例中,由于报文发送模块103要将报文通过数据网络发送,而报文发送模块103是数据网络的起点;在发送所述报文时,时间记录模块102记录下所述报文进入数据网络时、入口时钟的时间戳,所述时间戳与所述报文对应。作为一种实施方式,在报文进入数据网络的位置设置入口时钟,也即在所述报文发送装置的输出端口处设置入口时钟,所述入口时钟用于实时记录报文进入数据网络的时间。In this embodiment, the message sending module 103 sends the message through the data network, and the message sending module 103 is the starting point of the data network. When the message is sent, the time recording module 102 records the message. The timestamp of the entry clock when entering the data network, the timestamp corresponding to the message. As an implementation manner, an entry clock is set at a location where the packet enters the data network, that is, an entry clock is set at an output port of the packet sending device, and the entry clock is used to record the time when the packet enters the data network in real time. .
其中,所述入口时钟的记录精度可以很高,可以精确到报文进入数据网络的瞬间,即记录下当时的时间;例如可精确到秒、毫秒、微妙,甚至皮秒、纳秒等等;精度越高,传递时间的波动就越小。本实施中对于时钟的形式,或者说原理没有限定,不管是机械钟,还是电子钟,石英钟,原子钟等等,都是可行的。The recording precision of the entry clock can be very high, and can be accurate to the moment when the message enters the data network, that is, the time at which the time is recorded; for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, and the like; The higher the accuracy, the smaller the fluctuation in transit time. In this implementation, the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like.
由于需要记录报文发送模块103发送报文的时间,以及报文接收装置接收报文的时间,那么,所述入口时钟和报文接收装置的出口时钟的时间应该同步;同步的含义是,入口时钟和出口时钟的时间是一致的,或者入口时钟的时间和出口时钟的时间之间的换算关系是确定的。例如,北京所在的时区是东八区,东京所在的时区是东九区,那么,北京的时间与东京的时间之间就有一个小时的时差;因此,若报文发送装置处于北京,而报文接收装置处于东京,则记录的时间戳就应该加上一个小时,或者出口时钟的时间要减去一个小时,这样才能使入口时钟和出口时钟同步。 The time of the exit clock and the exit clock of the packet receiving device should be synchronized because the time when the packet sending module 103 needs to send the packet and the time when the packet receiving device receives the packet should be synchronized; the meaning of the synchronization is that the entry is The time between the clock and the exit clock is the same, or the conversion relationship between the time of the entry clock and the time of the exit clock is determined. For example, the time zone where Beijing is located is Dongba District, and the time zone where Tokyo is located is Dongjiu District. Then there is an hour difference between Beijing time and Tokyo time; therefore, if the message sending device is in Beijing, it is reported. If the text receiving device is in Tokyo, the time stamp of the record should be added by one hour, or the time of the exit clock should be subtracted by one hour, so that the entry clock and the exit clock can be synchronized.
其中,所述入口时钟和所述出口时钟的同步方式,可以包括多种;一般来说,时钟的同步方式分为两大类,其一,是出口时钟和入口时钟之间进行同步,即以出口时钟/入口时钟为基准,使所述出口时钟相对应的入口时钟与所述出口时钟一致,或者使所述入口时钟相对应的出口时钟与所述入口时钟一致;这样同步的结果是两个时钟的绝对时间并不一定准确,但对本实施例的实现没有影响;其二,是出口时钟和入口时钟均与基准时钟进行同步,即以一个第三方的标准的时钟为基准,记为基准时钟,使出口时钟和入口时钟均与所述基准时钟同步,相应的,出口时钟和入口时钟之间达成同步。具体的,同步的方式可以包括:GPS、NTP、中国北斗卫星导航系统、原子钟、IEEE1588等等任何同步的方式均可。The manner of synchronizing the ingress clock and the egress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is to synchronize between the egress clock and the ingress clock, that is, Taking an exit clock/ingress clock as a reference, the entry clock corresponding to the exit clock is coincident with the exit clock, or the exit clock corresponding to the entry clock is consistent with the entry clock; The absolute time of the clock is not necessarily accurate, but has no effect on the implementation of the embodiment. Second, the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock. The exit clock and the entry clock are both synchronized with the reference clock, and correspondingly, the synchronization between the exit clock and the entry clock is achieved. Specifically, the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
此时时间记录模块102已经获取了与报文对应的时间戳;为了使所述时间戳能够被报文接收装置得知,因此,需要将所述时间戳和报文组合后通过数据网络发送。之所以要组合发送,是为了避免报文和时间戳不能同时到达报文接收装置,从而给报文接收装置进行比对带来麻烦。但在其他实施方式中,即使时间戳与对应的报文未同时到达报文接收装置,对于本实施例的实现也不会有太大的影响。At this time, the time recording module 102 has acquired the timestamp corresponding to the message; in order to enable the timestamp to be known by the message receiving device, the timestamp and the message need to be combined and sent through the data network. The reason for the combination transmission is to prevent the message and the time stamp from being able to reach the message receiving device at the same time, thereby causing trouble for the message receiving device to perform comparison. However, in other embodiments, even if the timestamp and the corresponding message do not arrive at the message receiving device at the same time, the implementation of the embodiment does not have much influence.
作为一种实施方式,所述装置还包括第一封装模块1031,配置为在记录了报文进入数据网络的时间戳后,将所述时间戳插入到所述报文中,对所述报文重新进行封装。这样可以保证报文和与其对应的时间戳会同时到达报文接收装置。具体的,所述时间戳可以插入报文中的多个位置中的任一位置,如报文头部、报文头部和有效内容之间,或者是报文的尾部均可。As an embodiment, the device further includes a first encapsulating module 1031, configured to insert the timestamp into the packet after the timestamp of the packet entering the data network is recorded, and the packet is inserted into the packet. Repackage. This ensures that the message and its corresponding timestamp will arrive at the message receiving device at the same time. Specifically, the timestamp can be inserted into any of a plurality of locations in the packet, such as a packet header, a packet header, and a payload, or a trailer at the end of the packet.
报文在原始的内容中增加了时间戳这一数据,因此,通常需要对报文重新封装;所述重新封装,包括但不限于:重新计算报文长度内容、重新计算报文的CRC校验字节等。再对报文进行重新封装之后,就可以顺利的将封装后的报文发送给通过数据网络发送给报文接收装置,然后由报文接 收装置对报文进行处理。The packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated. The re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the CRC of the packet. Bytes, etc. After the packet is re-encapsulated, the encapsulated packet can be sent to the packet receiving device through the data network, and then the packet is received. The receiving device processes the message.
本实施例中,所述报文发送装置中的时间记录模块102,在实际应用中均可由所述装置中的中央处理器(CPU,Central Processing Unit)、数字信号处理器(DSP,Digital Signal Processor)、微控制单元(MCU,Microcontroller Unit)或可编程门阵列(FPGA,Field-Programmable Gate Array)实现;所述报文发送装置中的报文发送模块103,在实际应用中可通过通信模组(包含:基础通信套件、操作系统、通信模块、标准化接口和协议等)及收发天线实现;所述报文发送装置中的报文生成模块101,在实际应用中可通过CPU、DSP、MCU或FPGA实现,或者通过通信模组实现。In this embodiment, the time recording module 102 in the message sending device may be implemented by a central processing unit (CPU, Central Processing Unit) and a digital signal processor (DSP, Digital Signal Processor) in the device. , a micro-control unit (MCU) or a field-programmable gate array (FPGA); the message sending module 103 in the message sending device can pass the communication module in practical applications. (including: basic communication suite, operating system, communication module, standardized interface and protocol, etc.) and transceiver antenna implementation; the message generation module 101 in the message sending device can be used by the CPU, DSP, MCU or The FPGA is implemented or implemented by a communication module.
本实施例还提供了一种报文接收装置,请参考图5,包括:This embodiment further provides a message receiving apparatus. Referring to FIG. 5, the method includes:
报文接收模块201,配置为通过数据网络接收报文以及报文进入数据网络时入口时钟的时间戳;The message receiving module 201 is configured to receive the message through the data network and the time stamp of the entry clock when the message enters the data network;
时间确定模块202,配置为根据时间戳以及预设最大时延,确定报文的输出时刻;The time determining module 202 is configured to determine an output moment of the packet according to the timestamp and the preset maximum delay.
报文缓存模块203,配置为若出口时钟的时间点小于输出时刻,则对报文进行缓存,其中,所述出口时钟和所述入口时钟同步。The message buffering module 203 is configured to cache the message if the time point of the egress clock is less than the output time, wherein the egress clock is synchronized with the ingress clock.
本实施例中,所述报文接收模块201接收通过数据网络传输的报文;报文传输时间并不是确定的,也即传输的时间和报文到达的时间都不是确定的,这是由于数据网络自身并没有一个确定的传输时间。而时间戳就是报文进入数据网络时,入口时钟的时间。In this embodiment, the message receiving module 201 receives the message transmitted through the data network; the message transmission time is not determined, that is, the time of transmission and the arrival time of the message are not determined, which is due to the data. The network itself does not have a certain transmission time. The timestamp is the time of the entry clock when the message enters the data network.
作为一种实施方式,时间戳和报文组合通过数据网络发送的,即时间戳和报文同时到达报文接收模块201;之所以要组合发送,是为了避免报文和时间戳不能同时到达报文接收模块201,从而给比对带来麻烦。但在其他实施方式中,即使时间戳与对应的报文未同时到达报文接收模块201,对于本实施例的实现也不会有太大的影响。 As an implementation manner, the timestamp and the packet combination are sent through the data network, that is, the timestamp and the message arrive at the message receiving module 201 at the same time; the reason for the combination is to prevent the message and the timestamp from being simultaneously reported. The text receiving module 201 causes trouble in comparison. However, in other implementation manners, even if the timestamp and the corresponding message do not arrive at the message receiving module 201 at the same time, the implementation of the embodiment does not have much influence.
本实施例中,除了接收到的报文对应的时间戳,还具有预设最大时延以及出口时钟的时间点。出口时钟的时间点,即为出口时钟所提示的时间。出口时钟与入口时钟类似,它的精度可以很高,例如可精确到秒、毫秒、微妙,甚至皮秒、纳秒等等;精度越高,报文传递的时间就越精确,越能使报文以预期的时延输出;本实施例中对时钟的形式,或者说原理并没有限定,不管是机械钟,还是电子钟,石英钟,原子钟等等,都是可行的。其中,所述出口时钟的精度与所述入口时钟的精度可以相同。In this embodiment, in addition to the timestamp corresponding to the received packet, the preset maximum delay and the time point of the exit clock are also included. The time point of the exit clock is the time indicated by the exit clock. The exit clock is similar to the entrance clock. Its accuracy can be very high, for example, it can be accurate to seconds, milliseconds, subtle, even picoseconds, nanoseconds, etc. The higher the accuracy, the more accurate the message delivery time. The output is expected to be delayed; in this embodiment, the form, or principle, of the clock is not limited, and it is feasible whether it is a mechanical clock, an electronic clock, a quartz clock, an atomic clock, or the like. The accuracy of the exit clock may be the same as the accuracy of the entry clock.
本实施例中,所述时间确定模块202,配置为计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。输出时刻指的是一个时间点,报文被允许在满足大于等于时间戳与预设最大时间之和的这一时间点输出,也被允许在满足大于时间戳与预设最大时间之和的时间点输出;输出时刻虽然是一个时间点,但并不意味着报文一定会在这一时刻输出,事实上,输出时刻是报文允许被输出的最早时间点,即一种时间点,可以保证报文从发送到输出能够经过一段固定的时间且这个固定的时间还尽可能的短,保证了效率。In this embodiment, the time determining module 202 is configured to calculate a sum of the timestamp and the preset maximum delay, and determine that the output time of the packet is greater than or equal to the timestamp and the preset maximum The sum of the delays. The output time refers to a time point, and the message is allowed to output at a time point that satisfies the sum of the time stamp equal to or greater than the preset maximum time, and is also allowed to satisfy the time greater than the sum of the time stamp and the preset maximum time. Point output; although the output time is a time point, it does not mean that the message will be output at this moment. In fact, the output time is the earliest time point at which the message is allowed to be output, that is, a time point, which can be guaranteed. The message can be sent from the transmission to the output for a fixed period of time and this fixed time is as short as possible, ensuring efficiency.
上面还提到了预设最大时延。由于报文在数据网络中传输的时间并不固定,因此,本实施例中设定了一个固定的预设最大时延,通过这个预设最大时延使得报文从发送到输出之间的时间是固定的,该固定的传输时间即为预设最大时延。所述预设最大时延就是一种预设的、使报文延迟固定时长的时间。通常来说,虽然数据网络中传输的报文其传输时间并不固定,但一般会有一个传输时间的最大值,即最大延迟时间;而在正常的传输过程中,报文不会超过这个最大延迟时间,传输的时间都是小于这个最大延迟时间的。所述最大延迟时间一般是实验数据,即通过多次采样确定,从报文发送装置到报文接收装置,在正常情况下,报文的延迟时间最大不超过的数值。本实施例中的预设最大时延,一般指的是最大延迟时间,这样, 报文在数据网络中传输的时间不会超过该预设最大时延,因此,就能将报文从发送到输出这段时间固定下来,减少甚至不产生波动,使报文的传输更加稳定。当然,预设最大时延也可以根据需求进行调整,只要其在合理的范围内即可。The preset maximum delay is also mentioned above. Since the time for transmitting the packet in the data network is not fixed, in this embodiment, a fixed preset maximum delay is set, and the time between sending and output of the packet is determined by the preset maximum delay. It is fixed, and the fixed transmission time is the preset maximum delay. The preset maximum delay is a preset time for delaying the message for a fixed period of time. Generally speaking, although the transmission time of the packets transmitted in the data network is not fixed, there is usually a maximum transmission time, that is, the maximum delay time. In the normal transmission process, the message does not exceed this maximum. The delay time, the transmission time is less than this maximum delay time. The maximum delay time is generally experimental data, that is, a value determined by multiple sampling, from the message transmitting device to the message receiving device, under normal circumstances, the delay time of the message is not exceeded at most. The preset maximum delay in this embodiment generally refers to the maximum delay time, such that The time that the packet is transmitted in the data network does not exceed the preset maximum delay. Therefore, the time from the transmission to the output can be fixed, reducing or not causing fluctuations, and the transmission of the packet is more stable. Of course, the preset maximum delay can also be adjusted according to the needs, as long as it is within a reasonable range.
本实施例中,由于时间戳是入口时钟的时间,因此,出口时钟应该和入口时钟同步;同步的含义是,入口时钟和出口时钟的时间是一致的,或者入口时钟的时间和出口时钟的时间之间的换算关系是确定的。In this embodiment, since the timestamp is the time of the entry clock, the exit clock should be synchronized with the entry clock; the meaning of the synchronization is that the time of the entry clock and the exit clock are consistent, or the time of the entry clock and the time of the exit clock The conversion relationship between them is deterministic.
其中,所述出口时钟和所述入口时钟之间的同步方式,可以包括多种;一般来说,时钟的同步方式分为两大类,其一,是出口时钟和入口时钟之间进行同步,即以出口时钟/入口时钟为基准,使所述出口时钟相对应的入口时钟与所述出口时钟一致,或者使所述入口时钟相对应的出口时钟与所述入口时钟一致;这样同步的结果是两个时钟的绝对时间并不一定准确,但对本实施例的实现没有影响,只要这两者之间的时间同步即可;其二,是出口时钟和入口时钟均与基准时钟进行同步,即以一个第三方的标准的时钟为基准,记为基准时钟,使出口时钟和入口时钟均与所述基准时钟同步,相应的,出口时钟和入口时钟之间达成同步。具体的,同步的方式可以包括:GPS、NTP、中国北斗卫星导航系统、原子钟、IEEE1588等等任何同步的方式均可。The synchronization mode between the egress clock and the ingress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock. That is, the egress clock corresponding to the egress clock is aligned with the egress clock, or the egress clock corresponding to the ingress clock is consistent with the entry clock, based on the egress clock/ingress clock; The absolute time of the two clocks is not necessarily accurate, but has no effect on the implementation of the embodiment, as long as the time synchronization between the two is sufficient; the second is that both the exit clock and the entry clock are synchronized with the reference clock, that is, A third-party standard clock is used as a reference, and is recorded as a reference clock, so that both the egress clock and the ingress clock are synchronized with the reference clock, and accordingly, the egress clock and the ingress clock are synchronized. Specifically, the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
本实施例中,当出口时钟的时间点小于输出时刻时,报文缓存模块203就对报文进行缓存。需要说明的是,出口时钟的时间点,并不只是报文到达报文接收模块201那一瞬间的时间,所述出口时钟的时间点指的就是出口时钟上所提示的时间;由于出口时钟的所提示的时间是一直在流逝中的,因此,出口时钟的时间点小于输出时刻时,应该继续进行比对。作为一种实施方式,所述装置还包括报文输出模块204,配置为当出口时钟的时间点小于输出时刻,则在出口时钟的时间点达到所述输出时刻时,输出所述报 文;当出口时钟的时间点大于等于所述输出时刻时,直接输出所述报文。具体的,在出口时钟的时间点小于输出时刻时,输出时刻就是报文的真实向外输出的时间;在出口时钟的时间点大于输出时刻时,就可以直接输出报文。In this embodiment, when the time point of the egress clock is less than the output time, the message caching module 203 buffers the message. It should be noted that the time point of the egress clock is not only the time when the packet arrives at the packet receiving module 201, and the time point of the egress clock refers to the time indicated on the egress clock; The indicated time is always elapsed. Therefore, when the time point of the exit clock is less than the output time, the comparison should be continued. As an embodiment, the device further includes a message output module 204 configured to output the report when the time point of the exit clock is less than the output time, when the output time is reached at the time of the exit clock If the time point of the exit clock is greater than or equal to the output time, the message is directly output. Specifically, when the time of the exit clock is less than the output time, the output time is the time of the true outward output of the message; when the time of the exit clock is greater than the output time, the message can be directly output.
本实施例中,在报文刚刚到达报文接收模块201时,显然,此时出口时钟的时间点,或者说出口时钟提示的时间与时间戳之差,就是报文在数据网络中传输的时间。由前述可知,这一时间并不是固定的,它是经常会浮动的,因此,本实施例提供了预设最大时延的概念;若出口时钟的时间点一直小于输出时刻,就由所述报文缓存模块203一直对所述报文进行缓存。而在缓存期间,出口时钟的时间点会越来越接近输出时刻,而在出口时钟的时间点等于输出时刻时,就可以由报文输出模块204输出该报文。In this embodiment, when the message has just arrived at the message receiving module 201, it is obvious that the time point of the exit clock or the time difference between the time and the time stamp of the exit clock is the time when the message is transmitted in the data network. . It can be seen from the foregoing that this time is not fixed, and it is often floating. Therefore, this embodiment provides the concept of preset maximum delay; if the time point of the exit clock is always smaller than the output time, the report is The text cache module 203 always caches the message. During the buffering period, the time point of the exit clock will be closer to the output time, and when the time point of the exit clock is equal to the output time, the message output module 204 can output the message.
作为一种实施方式,所述报文输出模块204还包括第二封装模块2041,配置为当时间戳是封装在报文中时,将所述时间戳从所述报文中移除,对所述报文进行重新封装并输出。重新封装包括但不限于:重新计算报文长度内容、重新计算报文的CRC校验字节等。As an embodiment, the message output module 204 further includes a second encapsulating module 2041, configured to remove the timestamp from the packet when the timestamp is encapsulated in the packet, The message is repackaged and output. Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
输出的报文可以输出到所需的地方,从而实现所需的功能;在本实施例中,可以使报文从发送到输出所经过的时间是一致的,换句话说,只要在发送报文时,对有时序的报文设置先后顺序,那就可以保证报文在输出时,其也是按照预设的时序进行输出的。对于同一个报文接收装置而言,在发送时,设置两个报文之间的时序,在经过数据网络的传送后,先发送的报文即使后接收,也会因为后发送的报文先到却没有满足输出时刻的要求而被缓存,就使得先发送的报文仍然能保证被先输出;而报文发送装置将有时序的报文发送给不同的报文接收装置也是一样,同样能够保证报文发送时的时序与接收时的时序一致,从而使用户操作更加简便且可靠。The outputted message can be output to the desired place to achieve the desired function; in this embodiment, the time elapsed from the transmission of the message to the output is consistent, in other words, as long as the message is transmitted. When the sequence of the messages is set in sequence, it can ensure that when the message is output, it is also output according to the preset timing. For the same message receiving device, when transmitting, the timing between two messages is set. After the data network is transmitted, if the first message is received later, the message will be sent first. The buffer is not satisfied by the requirement of the output time, so that the first transmitted message can still be output first; and the message transmitting device sends the timed message to different message receiving devices, and the same can be performed. It ensures that the timing when the message is sent is consistent with the timing at the time of receiving, making the user's operation easier and more reliable.
本实施例中,所述报文接收装置中的时间确定模块202,在实际应用中 均可由所述装置中的CPU、DSP、MCU或FPGA实现;所述报文接收装置中的报文接收模块201,在实际应用中可通过通信模组(包含:基础通信套件、操作系统、通信模块、标准化接口和协议等)及收发天线实现;所述报文发送装置中的报文缓存模块203,在实际应用中可通过存储器实现。In this embodiment, the time determining module 202 in the message receiving device is in an actual application. It can be implemented by a CPU, a DSP, an MCU or an FPGA in the device; the message receiving module 201 in the message receiving device can pass through a communication module (including: basic communication suite, operating system, communication) in practical applications. The module, the standardized interface and the protocol, and the transmitting and receiving antennas are implemented; the message buffering module 203 in the message sending device can be implemented in a memory in an actual application.
本实施例提供了一种报文处理系统,包括上述的报文发送装置和报文接收装置,其中:The embodiment provides a message processing system, including the above-mentioned message sending device and message receiving device, wherein:
所述报文发送装置,配置为获得报文;记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;通过所述数据网络发送所述时间戳与所述报文至所述报文接收装置;The message sending device is configured to obtain a message; record a timestamp of an entry clock when the message enters the data network; wherein the entry clock is synchronized with an exit clock; and the timestamp is sent through the data network Transmitting the message to the message receiving device;
所述报文接收装置,配置为通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;当出口时钟的时间点小于所述输出时刻时,则对所述报文进行缓存,所述出口时钟与所述入口时钟同步。The packet receiving device is configured to receive a packet through a data network and a timestamp of an entry clock when the packet enters the data network; and determine the packet according to the timestamp and a preset maximum delay. Output time; when the time point of the exit clock is less than the output time, the message is buffered, and the exit clock is synchronized with the entry clock.
作为一种实施方式,所述报文发送装置,配置为将所述时间戳插入到所述报文中;对所述报文重新进行封装,并通过所述数据网络发送重新封装后的报文。As an implementation manner, the packet sending apparatus is configured to insert the time stamp into the packet, re-encapsulate the packet, and send the re-encapsulated packet through the data network. .
本实施例中,所述报文接收装置,配置为计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。In this embodiment, the packet receiving apparatus is configured to calculate a sum of the timestamp and the preset maximum delay, and determine that the output time of the packet is greater than or equal to the timestamp and the preset maximum The sum of the delays.
本实施例中,所述报文接收装置,配置为当所述出口时钟的时间点大于等于所述输出时刻时,输出所述报文。In this embodiment, the message receiving apparatus is configured to output the message when the time point of the egress clock is greater than or equal to the output time.
本实施例中,所述报文接收装置,配置为当所述时间戳被封装入所述报文时,将所述时间戳从所述报文中移除;对所述报文重新进行封装并输出。In this embodiment, the packet receiving apparatus is configured to remove the timestamp from the packet when the timestamp is encapsulated into the packet, and re-encapsulate the packet. And output.
本发明实施例中,所述报文发送装置和所述报文接收装置具体可参照 前述实施例的描述所述,这里不再赘述;所述报文发送装置的组成结构具体可结合图4所示;所述报文接收装置的组成结构具体可结合图5所示。In the embodiment of the present invention, the packet sending apparatus and the packet receiving apparatus may specifically refer to The description of the foregoing embodiment is not repeated here; the composition of the packet sending apparatus may be specifically shown in FIG. 4; the composition of the packet receiving apparatus may be specifically shown in FIG. 5.
基于图4和图5所示的报文发送装置和报文接收装置,本实施例提供了一种报文处理方法,请参考图6,包括:The packet sending apparatus and the packet receiving apparatus shown in FIG. 4 and FIG. 5, the embodiment provides a packet processing method. Referring to FIG. 6, the method includes:
S401、获得报文。S401. Obtain a message.
所述报文可由所述报文生成模块101生成,并不一定是报文生成模块101本身生成的,也可以是其他装置生成后发送给报文发送装置的;所述报文发送模块103是报文通过数据网络发送的起点,报文在报文发送模块103进入数据网络。The packet may be generated by the packet generating module 101, and may not be generated by the packet generating module 101 itself, or may be sent by other devices to the packet sending device; the packet sending module 103 is The message passes through the starting point of the data network, and the message enters the data network in the message sending module 103.
S402、记录报文进入数据网络时入口时钟的时间戳,将所述时间戳插入所述报文中;其中,所述入口时钟与出口时钟同步。S402. Record a timestamp of the entry clock when the packet enters the data network, and insert the timestamp into the packet; wherein the entry clock is synchronized with the exit clock.
所述入口时钟和所述出口时钟的同步方式,可以包括多种;一般来说,时钟的同步方式分为两大类,其一,是出口时钟和入口时钟之间进行同步,即以出口时钟/入口时钟为基准,使所述出口时钟相对应的入口时钟与所述出口时钟一致,或者使所述入口时钟相对应的出口时钟与所述入口时钟一致;这样同步的结果是两个时钟的绝对时间并不一定准确,但对本实施例的实现没有影响;其二,是出口时钟和入口时钟均与基准时钟进行同步,即以一个第三方的标准的时钟为基准,记为基准时钟,使出口时钟和入口时钟均与所述基准时钟同步,相应的,出口时钟和入口时钟之间达成同步。具体的,同步的方式可以包括:GPS、NTP、中国北斗卫星导航系统、原子钟、IEEE1588等等任何同步的方式均可。The manner of synchronizing the ingress clock and the egress clock may include multiple types. Generally, the synchronization mode of the clock is divided into two categories: one is synchronization between the egress clock and the ingress clock, that is, the egress clock. Taking the entry clock as a reference, making the entry clock corresponding to the exit clock coincide with the exit clock, or making the exit clock corresponding to the entry clock coincide with the entry clock; thus the result of the synchronization is two clocks The absolute time is not necessarily accurate, but has no effect on the implementation of the embodiment. Second, the exit clock and the entry clock are both synchronized with the reference clock, that is, based on a third-party standard clock, which is recorded as a reference clock. Both the egress clock and the ingress clock are synchronized with the reference clock, and accordingly, synchronization is achieved between the egress clock and the ingress clock. Specifically, the synchronization method may include: GPS, NTP, China Beidou satellite navigation system, atomic clock, IEEE1588, etc., any synchronous manner.
在记录了报文进入数据网络的时间戳后,就将所述时间戳插入到所述报文中,对所述报文重新进行封装。这样可以保证报文和与其对应的时间戳会同时到达报文接收装置。After the timestamp of the packet entering the data network is recorded, the timestamp is inserted into the packet, and the packet is re-encapsulated. This ensures that the message and its corresponding timestamp will arrive at the message receiving device at the same time.
S403、对插入时间戳的报文进行封装处理。 S403. Encapsulate the packet with the timestamp inserted.
报文在原始的内容中增加了时间戳这一数据,因此,通常需要对报文重新封装;所述重新封装,包括但不限于:重新计算报文长度内容、重新计算报文的CRC校验字节等。再对报文进行重新封装之后,就可以顺利的将封装后的报文发送给通过数据网络发送给报文接收装置,然后由报文接收装置对报文进行处理。The packet adds the timestamp to the original content. Therefore, the packet is usually re-encapsulated. The re-encapsulation includes, but is not limited to, recalculating the length of the packet and recalculating the CRC of the packet. Bytes, etc. After the packet is re-encapsulated, the encapsulated packet can be sent to the packet receiving device through the data network, and then the packet receiving device processes the packet.
S404、报文经过数据网络进行传送。S404: The message is transmitted through the data network.
S405、获取通过数据网络传送过来的携带时间戳的报文,并根据出口时钟的时间点以及预设最大时延确定输出时刻。S405. Acquire a time-stamped message transmitted through the data network, and determine an output time according to a time point of the exit clock and a preset maximum delay.
接收报文是通过数据网络传输的报文;报文传输时间并不是确定的,也即传输的时间和报文到达的时间都不是确定的,这是由于数据网络自身并没有一个确定的传输时间。The received message is a message transmitted through the data network; the message transmission time is not determined, that is, the time of transmission and the arrival time of the message are not determined, because the data network itself does not have a certain transmission time. .
S406、对报文进行缓存。S406: Cache the packet.
S407、判断出口时钟的时间点是否满足输出时刻;如满足,则转到S408;如不满足,则转到S406。S407. Determine whether the time point of the exit clock satisfies the output time; if yes, go to S408; if not, go to S406.
出口时钟的时间点小于输出时刻,或者说,出口时钟的时间点与时间戳之差,小于预设最大时延,那么,就认为出口时钟的时间点不满足输出时刻;不满足的话,就对报文进行缓存。The time point of the egress clock is less than the output time, or the difference between the time point of the egress clock and the timestamp is less than the preset maximum delay. Then, the time point of the egress clock is not satisfied with the output time; if it is not satisfied, the pair is The message is cached.
S408、去除报文中的时间戳,并对报文重新进行封装。S408. Remove the timestamp in the packet and re-encapsulate the packet.
在输出报文时,若时间戳是封装在报文中的,则需要将报文中的时间戳移除,然后对报文进行重新封装并输出。重新封装包括但不限于:重新计算报文长度内容、重新计算报文的CRC校验字节等。If the timestamp is encapsulated in the packet, the timestamp in the packet is removed and the packet is re-encapsulated and output. Re-encapsulation includes but is not limited to: recalculating the message length content, recalculating the CRC check byte of the message, and the like.
S409、将报文向外界输出。S409. Output the message to the outside world.
在本发明所提供的几个实施例中,应该理解到,所揭露的方法及装置,可以通过其他的方式实现。以上所描述的装置实施例仅仅是示意性的,例如,所述模块的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外 的划分方式,如:多个模块或组件可以结合,或可以集成到另一个系统,或一些特征可以忽略,或不执行。另外,所显示或讨论的各组成部分相互之间的通信连接可以是通过一些接口,设备或模块的间接耦合或通信连接,可以是电性的、机械的或其他形式的。In the several embodiments provided by the present invention, it should be understood that the disclosed method and apparatus may be implemented in other manners. The device embodiments described above are merely illustrative. For example, the division of the modules is only a logical function division, and the actual implementation may have another The way of dividing, such as: multiple modules or components can be combined, or can be integrated into another system, or some features can be ignored, or not executed. In addition, the communication connections between the various components shown or discussed may be indirect coupling or communication connections through some interfaces, devices or modules, and may be electrical, mechanical or otherwise.
上述作为分离部件说明的模块可以是、或也可以不是物理上分开的,作为模块显示的部件可以是、或也可以不是物理模块,即可以位于一个地方,也可以分布到多个网络模块上;可以根据实际的需要选择其中的部分或全部模块来实现本实施例方案的目的。The modules described above as separate components may or may not be physically separated. The components displayed as modules may or may not be physical modules, that is, may be located in one place or distributed to multiple network modules; Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the embodiment.
另外,在本发明各实施例中的各功能模块可以全部集成在一个处理模块中,也可以是各模块分别单独作为一个模块,也可以两个或两个以上模块集成在一个模块中;上述集成的模块既可以采用硬件的形式实现,也可以采用硬件加软件功能模块的形式实现。In addition, each functional module in each embodiment of the present invention may be integrated into one processing module, or each module may be separately used as one module, or two or more modules may be integrated into one module; The module can be implemented in the form of hardware or in the form of hardware plus software function modules.
本领域普通技术人员可以理解:实现上述方法实施例的全部或部分步骤可以通过程序指令相关的硬件来完成,前述的程序可以存储于计算机可读取存储介质中,该程序在执行时,执行包括上述方法实施例的步骤;而前述的存储介质包括:移动存储设备、只读存储器(ROM,Read-Only Memory)、磁碟或者光盘等各种可以存储程序代码的介质。It will be understood by those skilled in the art that all or part of the steps of implementing the foregoing method embodiments may be performed by hardware related to program instructions. The foregoing program may be stored in a computer readable storage medium, and when executed, the program includes The foregoing steps of the method embodiment; and the foregoing storage medium includes: a removable storage device, a read-only memory (ROM), a magnetic disk or an optical disk, and the like, which can store program codes.
或者,本发明实施例上述集成的模块如果以软件功能模块的形式实现并作为独立的产品销售或使用时,也可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明实施例的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得一台计算机设备(可以是个人计算机、服务器、或者网络设备等)执行本发明各个实施例所述方法的全部或部分。而前述的存储介质包括:移动存储设备、ROM、磁碟或者光盘等各种可以存储程序代码的介质。 Alternatively, the above-described integrated module of the embodiment of the present invention may be stored in a computer readable storage medium if it is implemented in the form of a software function module and sold or used as a stand-alone product. Based on such understanding, the technical solution of the embodiments of the present invention may be embodied in the form of a software product in essence or in the form of a software product stored in a storage medium, including a plurality of instructions. A computer device (which may be a personal computer, server, or network device, etc.) is caused to perform all or part of the methods described in various embodiments of the present invention. The foregoing storage medium includes various media that can store program codes, such as a mobile storage device, a ROM, a magnetic disk, or an optical disk.
本发明实施例中记载的存储器切换方法、装置只以上述实施例为例,但不仅限于此,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。The memory switching method and apparatus described in the embodiments of the present invention are only exemplified by the foregoing embodiments, but are not limited thereto, and those skilled in the art should understand that the technical solutions described in the foregoing embodiments may still be modified. Equivalent replacement of some or all of the technical features may be made without departing from the scope of the technical solutions of the embodiments of the present invention.
以上所述仅为本发明的较佳实施例而已,并非用于限定本发明的保护范围。The above is only the preferred embodiment of the present invention and is not intended to limit the scope of the present invention.
工业实用性Industrial applicability
本发明实施例的技术方案克服了由于报文在数据网络中传输的时间不确定而导致的报文输出不确定的问题,使报文可以按照固定的时间进行传输,为后续的处理提供便利,扩大了数据网络的应用范围,提升了用户体验。 The technical solution of the embodiment of the present invention overcomes the problem that the output of the packet is uncertain due to the uncertainty of the time of transmission of the packet in the data network, so that the packet can be transmitted according to a fixed time, which facilitates subsequent processing. Expanded the application range of the data network and improved the user experience.

Claims (20)

  1. 一种报文发送方法,包括:A method for sending a message, comprising:
    获得报文;Obtain a message;
    记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;Recording a timestamp of the entry clock when the packet enters the data network; wherein the entry clock is synchronized with the exit clock;
    通过所述数据网络发送所述时间戳与所述报文。Transmitting the timestamp and the message through the data network.
  2. 如权利要求1所述的报文发送方法,其中,所述通过所述数据网络发送所述时间戳与所述报文包括:将所述时间戳插入到所述报文中;对所述报文重新进行封装;通过所述数据网络发送重新封装后的报文。The method for transmitting a message according to claim 1, wherein the transmitting the timestamp and the message through the data network comprises: inserting the timestamp into the message; The packet is re-encapsulated; the re-encapsulated message is sent through the data network.
  3. 一种报文接收方法,包括:A message receiving method includes:
    通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;Receiving a message through the data network and a timestamp of the entry clock when the message enters the data network;
    根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;Determining an output moment of the packet according to the timestamp and a preset maximum delay;
    当出口时钟的时间点小于所述输出时刻时,则对所述报文进行缓存,其中,所述出口时钟与所述入口时钟同步。When the time point of the egress clock is less than the output time, the message is buffered, wherein the egress clock is synchronized with the entry clock.
  4. 如权利要求3所述的报文接收方法,其中,所述根据所述时间戳以及预设最大时延,确定所述报文的输出时刻包括:计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。The method of receiving a message according to claim 3, wherein the determining, according to the timestamp and the preset maximum delay, the output time of the message comprises: calculating the timestamp and the preset maximum time And determining, by the sum of the packets, an output moment of the packet is greater than or equal to a sum of the timestamp and the preset maximum delay.
  5. 如权利要求3或4所述的报文接收方法,其中,当所述出口时钟的时间点大于等于所述输出时刻时,所述方法还包括:输出所述报文。The message receiving method according to claim 3 or 4, wherein when the time point of the exit clock is greater than or equal to the output time, the method further comprises: outputting the message.
  6. 如权利要求5所述的报文接收方法,其中,当所述时间戳被封装入所述报文时,所述输出所述报文包括:将所述时间戳从所述报文中移除;对所述报文重新进行封装并输出。The packet receiving method according to claim 5, wherein when the time stamp is encapsulated into the message, the outputting the message comprises: removing the timestamp from the message The packet is re-encapsulated and output.
  7. 一种报文处理方法,包括: A packet processing method includes:
    获得报文;Obtain a message;
    记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;Recording a timestamp of the entry clock when the packet enters the data network; wherein the entry clock is synchronized with the exit clock;
    通过所述数据网络发送所述时间戳与所述报文;Transmitting the timestamp and the message by using the data network;
    通过数据网络接收报文以及所述报文进入所述数据网络时入口时钟的时间戳;Receiving a message through the data network and a timestamp of the entry clock when the message enters the data network;
    根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;Determining an output moment of the packet according to the timestamp and a preset maximum delay;
    当出口时钟的时间点小于所述输出时刻时,则对所述报文进行缓存,其中,所述出口时钟与所述入口时钟同步。When the time point of the egress clock is less than the output time, the message is buffered, wherein the egress clock is synchronized with the entry clock.
  8. 根据权利要求7所述的方法,其中,所述通过所述数据网络发送所述时间戳与所述报文包括:将所述时间戳插入到所述报文中;对所述报文重新进行封装,并通过所述数据网络发送重新封装后的报文。The method of claim 7 wherein said transmitting said timestamp and said message over said data network comprises: inserting said timestamp into said message; re-performing said message Encapsulating and transmitting the repackaged message through the data network.
  9. 根据权利要求7所述的方法,其中,所述根据所述时间戳以及预设最大时延,确定所述报文的输出时刻包括:计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。The method according to claim 7, wherein the determining the output moment of the packet according to the timestamp and the preset maximum delay comprises: calculating a sum of the timestamp and the preset maximum delay And determining that the output time of the packet is greater than or equal to a sum of the timestamp and the preset maximum delay.
  10. 根据权利要求7或9所述的方法,其中,当所述出口时钟的时间点大于等于所述输出时刻时,所述方法还包括:则输出所述报文。The method according to claim 7 or 9, wherein when the time point of the exit clock is greater than or equal to the output time, the method further comprises: outputting the message.
  11. 根据权利要求10所述的方法,其中,当所述时间戳被封装入所述报文时,所述输出所述报文包括:将所述时间戳从所述报文中移除;对所述报文重新进行封装并输出。The method of claim 10, wherein when the timestamp is encapsulated into the message, the outputting the message comprises: removing the timestamp from the message; The message is repackaged and output.
  12. 一种报文发送装置,包括:A message sending device includes:
    报文生成模块,配置为获得报文;a packet generation module configured to obtain a packet;
    时间记录模块,配置为记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步; a time recording module configured to record a timestamp of an entry clock when the packet enters the data network; wherein the entry clock is synchronized with an exit clock;
    报文发送模块,配置为通过所述数据网络发送所述时间戳与所述报文。The message sending module is configured to send the timestamp and the message through the data network.
  13. 如权利要求12所述的报文发送装置,其中,所述报文发送模块包括第一封装模块,配置为将所述时间戳插入到所述报文中,对所述报文重新进行封装。The message transmitting apparatus according to claim 12, wherein the message sending module comprises a first encapsulating module, configured to insert the time stamp into the message, and re-encapsulate the message.
  14. 一种报文接收装置,包括:A message receiving device includes:
    报文接收模块,配置为通过数据网络接收报文以及与所述报文进入所述数据网络时入口时钟的时间戳;a message receiving module, configured to receive a message through the data network and a timestamp of an entry clock when the message enters the data network;
    时间确定模块,配置为根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;a time determining module, configured to determine an output moment of the packet according to the timestamp and a preset maximum delay;
    报文缓存模块,配置为当出口时钟的时间点小于所述输出时刻时,对所述报文进行缓存,其中,所述出口时钟与所述入口时钟同步。The message cache module is configured to cache the message when the time point of the egress clock is less than the output time, wherein the egress clock is synchronized with the entry clock.
  15. 如权利要求14所述的报文接收装置,其中,所述时间确定模块,配置为计算所述时间戳与所述预设最大时延之和,确定所述报文的输出时刻大于等于所述时间戳与所述预设最大时延之和。The message receiving apparatus according to claim 14, wherein the time determining module is configured to calculate a sum of the timestamp and the preset maximum time delay, and determine that an output time of the message is greater than or equal to the The sum of the timestamp and the preset maximum delay.
  16. 如权利要求14或15所述的报文接收装置,其中,还包括报文输出模块,配置为当所述出口时钟的时间点大于等于所述输出时刻时,输出所述报文。The message receiving apparatus according to claim 14 or 15, further comprising a message output module configured to output the message when a time point of the exit clock is greater than or equal to the output time.
  17. 如权利要求16所述的报文接收装置,其中,当所述时间戳被封装入所述报文时,所述报文输出模块包括第二封装模块,配置为将所述时间戳从所述报文中移除,对所述报文重新进行封装并输出。The message receiving apparatus according to claim 16, wherein, when the time stamp is encapsulated into the message, the message output module includes a second encapsulation module configured to set the time stamp from the The packet is removed, and the packet is re-encapsulated and output.
  18. 一种报文处理系统,包括报文发送装置和报文接收装置;A message processing system, comprising a message sending device and a message receiving device;
    所述报文发送装置,配置为获得报文;记录所述报文进入数据网络时入口时钟的时间戳;其中,所述入口时钟与出口时钟同步;通过所述数据网络发送所述时间戳与所述报文至所述报文接收装置;The message sending device is configured to obtain a message; record a timestamp of an entry clock when the message enters the data network; wherein the entry clock is synchronized with an exit clock; and the timestamp is sent through the data network Transmitting the message to the message receiving device;
    所述报文接收装置,配置为通过数据网络接收报文以及所述报文进入 所述数据网络时入口时钟的时间戳;根据所述时间戳以及预设最大时延,确定所述报文的输出时刻;当出口时钟的时间点小于所述输出时刻时,则对所述报文进行缓存,所述出口时钟与所述入口时钟同步。The message receiving apparatus is configured to receive a message through a data network and enter the message a timestamp of the entry clock of the data network; determining an output time of the packet according to the timestamp and a preset maximum delay; and when the time point of the exit clock is less than the output time, The file is cached, and the exit clock is synchronized with the entry clock.
  19. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求1或2所述的报文发送方法。A computer storage medium storing computer executable instructions for executing the message transmission method of claim 1 or 2.
  20. 一种计算机存储介质,所述计算机存储介质中存储有计算机可执行指令,所述计算机可执行指令用于执行权利要求3至6任一项所述的报文接收方法。 A computer storage medium storing computer executable instructions for performing the message receiving method according to any one of claims 3 to 6.
PCT/CN2017/076784 2016-04-05 2017-03-15 Message processing method, device, and system, and computer storage medium WO2017173915A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610207570.7A CN107294870A (en) 2016-04-05 2016-04-05 Message sending, receiving method and device and message processing method and system
CN201610207570.7 2016-04-05

Publications (1)

Publication Number Publication Date
WO2017173915A1 true WO2017173915A1 (en) 2017-10-12

Family

ID=60000881

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/076784 WO2017173915A1 (en) 2016-04-05 2017-03-15 Message processing method, device, and system, and computer storage medium

Country Status (2)

Country Link
CN (1) CN107294870A (en)
WO (1) WO2017173915A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112994824A (en) * 2021-03-03 2021-06-18 山东山大电力技术股份有限公司 Time synchronization method, device and system for IRIG-B code non-delay transmission

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115412508A (en) * 2021-05-28 2022-11-29 华为技术有限公司 Method and device for transmitting message
CN117834383A (en) * 2022-09-28 2024-04-05 中兴通讯股份有限公司 Time reference position transmission method, message position determination method and communication equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102123073A (en) * 2010-01-07 2011-07-13 华为技术有限公司 Packet reordering method and device
CN104168212A (en) * 2014-08-08 2014-11-26 北京华为数字技术有限公司 Method and device for message sending
CN104202131A (en) * 2014-08-21 2014-12-10 云南电力试验研究院(集团)有限公司电力研究院 Method for improving transmission real-time of sample data in electric power distribution network system
US20140369191A1 (en) * 2013-06-14 2014-12-18 Ciinow, Inc. Method and apparatus for controlling source transmission rate for video streaming based on queuing delay

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7379466B2 (en) * 2004-04-17 2008-05-27 Innomedia Pte Ltd In band signal detection and presentation for IP phone
CN101883392B (en) * 2009-05-05 2013-08-07 中兴通讯股份有限公司 Method and system for ensuring mobile network downward message QoS
CN102244603B (en) * 2010-05-11 2014-09-03 华为技术有限公司 Method, equipment and system for transmitting message bearing time
EP2882120B1 (en) * 2013-12-06 2016-03-09 ADVA Optical Networking SE A method and apparatus for mitigation of packet delay variation

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102123073A (en) * 2010-01-07 2011-07-13 华为技术有限公司 Packet reordering method and device
US20140369191A1 (en) * 2013-06-14 2014-12-18 Ciinow, Inc. Method and apparatus for controlling source transmission rate for video streaming based on queuing delay
CN104168212A (en) * 2014-08-08 2014-11-26 北京华为数字技术有限公司 Method and device for message sending
CN104202131A (en) * 2014-08-21 2014-12-10 云南电力试验研究院(集团)有限公司电力研究院 Method for improving transmission real-time of sample data in electric power distribution network system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112994824A (en) * 2021-03-03 2021-06-18 山东山大电力技术股份有限公司 Time synchronization method, device and system for IRIG-B code non-delay transmission

Also Published As

Publication number Publication date
CN107294870A (en) 2017-10-24

Similar Documents

Publication Publication Date Title
KR102037193B1 (en) Systems, devices, and methods for low-jitter communication over a packet-switched network
US8929405B2 (en) Method and apparatus for optimizing packet timing transport
US8107502B2 (en) Method and apparatus for monitoring packet networks
US9667408B2 (en) Communication systems and methods for distributed power system measurement
US9548831B2 (en) Synchronizing system, synchronizing method, first synchronizing device, second synchronizing device, and computer program
EP2530860B1 (en) A method and apparatus for transporting time related information in a packet switched network
US8982897B2 (en) Data block output apparatus, communication system, data block output method, and communication method
US20110134766A1 (en) Method and apparatus for finding latency floor in packet networks
WO2017101484A1 (en) Time synchronization method and device
WO2017173915A1 (en) Message processing method, device, and system, and computer storage medium
EP2882120B1 (en) A method and apparatus for mitigation of packet delay variation
EP2332274A1 (en) Methods and apparatus for providing modified timestamps in a communication system
US11050500B2 (en) Network interface with timestamping and data protection
WO2015131626A1 (en) Time synchronization method and apparatus for network devices and time synchronization server
US20020021717A1 (en) Method and system for transmit time stamp insertion in a hardware time stamp system for packetized data networks
US20220360350A1 (en) Method and apparatus for acquiring timestamp of data stream, storage medium, and electronic apparatus
US9065748B2 (en) Symmetrical latency with TDM circuit emulated service
EP2341650A1 (en) Transfer of a synchronization message through a packet radio network
US20150172154A1 (en) Minimizing symmetrical latency impact by jitter buffer for tdm ces
JP6341869B2 (en) Communication apparatus and communication system
US20200336938A1 (en) Data Communication
CN112217590A (en) System for controlling message transmission delay jitter applied to transformer substation system
Martínek et al. White Paper: Timestamping and Clock Synchronisation in P4-Programmable Platforms
JP7039125B2 (en) Time synchronization method, time synchronization program, time synchronization device, and time synchronization system

Legal Events

Date Code Title Description
NENP Non-entry into the national phase

Ref country code: DE

121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17778579

Country of ref document: EP

Kind code of ref document: A1

122 Ep: pct application non-entry in european phase

Ref document number: 17778579

Country of ref document: EP

Kind code of ref document: A1