Data transmission method and device, electronic equipment and storage medium
By using the sequence number and session timestamp in the timing verification field in the rail transit signal system for verification, the problems of cumbersome timing verification and insufficient protection capabilities in the prior art are solved, and the effect of simplifying the verification process and improving link establishment efficiency is achieved.
Patent Information
- Application Number
- CN202510282134.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-11
- Publication Date
- 2025-06-10
AI Technical Summary
In the existing rail transit signal systems, the timing verification process is too cumbersome, the protection capability is insufficient, and the link establishment efficiency is low.
Verify by obtaining the timing verification field of the transmission message, including the sequence number and session timestamp of the one and the other party. If the session timestamp of this party is equal to the session timestamp of the other party, and the sequence number of this party is greater than the other party's serial number, and the message transmission time is less than or equal to the preset delay threshold, it is determined that the message passes timing verification and obtains the application data domain.
The timing verification process is simplified, the accuracy of the verification results is improved, and the communication link can be established with only one handshake, which improves the link establishment efficiency.
Smart Images

Figure CN120128552A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of rail transit, and particularly to a data transmission method, device, electronic device, and storage medium. Background Art
[0002] The rail transit signal system usually includes multiple safety-related subsystems. The safety information interaction between each subsystem is realized through a safety communication protocol, and the data transmission between different subsystems is completed thereby.
[0003] In the prior art, the communication protocols used in the rail transit signal system include RSSP-I (Railway Signal Safety Protocol-I) and RSSP-II (Railway Signal Safety Protocol-II), etc. Each subsystem usually performs timing verification of transmitted information based on a serial number and a timing variable with a linear relationship.
[0004] However, the existing timing verification method not only has the problem of insufficient protection ability, but also the verification method is too cumbersome. Often, multiple handshake behaviors are required to establish a communication link, and the link establishment efficiency is low. Summary of the Invention
[0005] The present invention provides a data transmission method, device, electronic device, and storage medium to solve the problem that the timing verification process of transmitting data is too cumbersome.
[0006] According to one aspect of the present invention, there is provided a data transmission method, including:
[0007] In response to obtaining a first transmission message, obtaining the timing verification field of the first transmission message; wherein, the timing verification field includes a first own serial number, a first other party serial number, a first own session timestamp, and a first other party session timestamp;
[0008] If it is determined that the current own session timestamp is equal to the first other party session timestamp, and the first own serial number is greater than the second other party serial number stored locally, it is determined that the first transmission message passes the timing verification, and the application data field in the first transmission message is obtained.
[0009] After determining that the current local session timestamp is equal to the first peer session timestamp and the first local sequence number is greater than the second peer sequence number stored locally, it further includes: obtaining the message transmission time according to the second local sequence number when the first transmission message is obtained and the first peer sequence number, and comparing the message transmission time with a preset delay threshold; determining that the first transmission message passes the timing check includes: if it is determined that the message transmission time is less than or equal to the preset delay threshold, determining that the first transmission message passes the timing check.
[0010] After obtaining the timing check field of the first transmission message, it further includes: if it is determined that the current local session timestamp is not equal to the first peer session timestamp, or the first local sequence number is less than or equal to the second peer sequence number stored locally, or the message transmission time is greater than the preset delay threshold, determining that the first transmission message fails the timing check and discarding the first transmission message.
[0011] The first transmission message further includes at least one of a message header, a message tail, and a redundancy check field; the message header includes at least one of a source address, a destination address, a protocol version, a data length, and a data nature; the protocol version includes a communication protocol version and an application data version.
[0012] The data transmission method further includes: in response to obtaining updated data to be transmitted, configuring the updated data in the application data field of a second transmission message and sending the second transmission message; if feedback information of the second transmission message is not obtained, continuing to send the second transmission message with the subsequent local sequence number until feedback information of the second transmission message is obtained, configuring null data in the application data field of a third transmission message and sending the third transmission message.
[0013] The data transmission method further includes: if no valid transmission message is obtained within a preset time threshold, updating the local session timestamp and sending the updated local session timestamp; wherein, the valid transmission message refers to a transmission message that passes the timing check.
[0014] According to another aspect of the present invention, there is provided a data transmission device, including:
[0015] A timing check field acquisition module, configured to, in response to obtaining a first transmission message, acquire the timing check field of the first transmission message; wherein, the timing check field includes a first local sequence number, a first peer sequence number, a first local session timestamp, and a first peer session timestamp;
[0016] An application data field acquisition module, configured to determine that the first transmission message passes the timing check and acquire the application data field in the first transmission message if it is determined that the current local session timestamp is equal to the first peer session timestamp and the first local sequence number is greater than the second peer sequence number stored locally.
[0017] According to another aspect of the present invention, there is provided an electronic device, which includes:
[0018] At least one processor; and
[0019] A memory communicatively connected to the at least one processor; wherein,
[0020] The memory stores a computer program executable by the at least one processor, and when the computer program is executed by the at least one processor, the at least one processor is enabled to execute the data transmission method according to any embodiment of the present invention.
[0021] According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement the data transmission method according to any embodiment of the present invention when executed.
[0022] According to another aspect of the present invention, there is provided a computer program product including a computer program that implements the data transmission method according to any embodiment of the present invention when executed by a processor.
[0023] The technical solution of the embodiment of the present invention, in response to obtaining a first transmission message, obtains a timing check field including a first local sequence number, a first peer sequence number, a first local session timestamp, and a first peer session timestamp; if it is determined that the current local session timestamp is equal to the first peer session timestamp and the first local sequence number is greater than the second peer sequence number stored locally, it is determined that the first transmission message passes the timing check, and the application data field in the first transmission message is obtained. Thereby, not only the accuracy of the timing check result is improved, but also the timing check process is simplified, and only one handshake behavior is required to establish a communication link, improving the link establishment efficiency.
[0024] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present invention, nor is it used to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. Description of the Drawings
[0025] To more clearly illustrate the technical solutions in the embodiments of the present invention, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.
[0026] Figure 1 is a flowchart of a data transmission method provided in Embodiment 1 of the present invention;
[0027] Figure 2 is a message interaction flowchart between two devices provided in Embodiment 1 of the present invention;
[0028] Figure 3 is a schematic diagram of message delay between two devices provided in Embodiment 1 of the present invention;
[0029] Figure 4 is a flowchart of another data transmission method provided in Embodiment 2 of the present invention;
[0030] Figure 5 is a flowchart of transmitting updated data between two devices provided in Embodiment 2 of the present invention;
[0031] Figure 6 is a flowchart of handling communication failures between two devices provided in Embodiment 2 of the present invention;
[0032] Figure 7 is a flowchart of retransmitting data protection between two devices provided in Embodiment 2 of the present invention;
[0033] Figure 8 is a flowchart of yet another data transmission method provided in Embodiment 3 of the present invention;
[0034] Figure 9 is a schematic structural diagram of a data transmission device provided in Embodiment 4 of the present invention;
[0035] Figure 10 is a schematic structural diagram of an electronic device for implementing the data transmission method in the embodiments of the present invention. Detailed implementation manners
[0036] To enable those skilled in the art to better understand the solutions of the present invention, the following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0037] It should be noted that the terms "first", "second", etc. in the specification, claims and above-mentioned drawings of the present invention are used to distinguish similar objects and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances so that the embodiments of the present invention described herein can be implemented in an order different from those illustrated or described herein. In addition, the terms "comprising" and "having" and any variations thereof are intended to cover non-exclusive inclusion. For example, a process, method, system, product or device comprising a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0038] Embodiment 1
[0039] Figure 1 FIG. is a flowchart of a data transmission method provided in Embodiment 1 of the present invention. This embodiment is applicable to the case of performing timing verification based on the other party's sequence number and the other party's session timestamp. This method can be executed by the data transmission device in any embodiment of the present invention. The data transmission device can be implemented in the form of hardware and / or software, and the data transmission device can be configured in each safety subsystem in the rail transit signal system. Each safety subsystem can exist in the form of one or more electronic devices (for example, servers), such as Figure 1 shown, the method includes:
[0040] S101. In response to obtaining a first transmission message, obtain the timing verification field of the first transmission message; wherein, the timing verification field includes a first own sequence number, a first other party sequence number, a first own session timestamp, and a first other party session timestamp.
[0041] A transmission message refers to the data information transmitted between two devices. The above two devices can transmit messages based on a periodic communication method; the transmission message includes the transmission information sent by the data sending end to the data receiving end, and also includes the feedback information sent by the data receiving end to the data sending end; the message structure of the transmission message includes a timing verification field, which is composed of an own sequence number, an other party sequence number, an own session timestamp, and an other party session timestamp. The number of bits of each component element can be pre-configured. For example, the own sequence number, the other party sequence number, the own session timestamp, and the other party session timestamp are all configured to be 8 bytes.
[0042] The local sequence number is the local cycle count value when this message is sent. This value is incremented by 1 in each cycle. Regardless of whether a message is sent in the current cycle, the local sequence number will gradually increase according to the cycle change (i.e., time change). When it reaches the maximum value, it will return to the initial value 1 and continue to increase gradually. If the local sequence number is configured to be 8 bytes, the value range of the local sequence number is clearly from 1 to 0xFFFFFFFFFFFFFFFF. The peer sequence number is the sequence number of the most recent valid message received by the local side when this message is sent. This sequence number is assigned by the peer when the above-mentioned valid message is sent by the peer. If no message sent by the peer has been received, this value is 0.
[0043] The local session timestamp is the system time value updated when the current device is first started or each time the communication is disconnected and then restored. It records the local system time of the current cycle. As long as the session communication between the current device and the peer device is not interrupted, regardless of how many interactive messages there are between the two, the local session timestamp will not change. Correspondingly, the peer session timestamp is the session time of the most recent valid message received by the local side when this message is sent. This session time is assigned by the peer when the above-mentioned valid message is sent by the peer. If no message sent by the peer has been received, this value is also 0.
[0044] Specifically, both the local session timestamp and the peer session timestamp can be represented in the following form: "YYYYMMDDHHMMSS00". Among them, "YYYY" represents the year, "MM" represents the month, "DD" represents the date, "HH" represents the hour, "MM" represents the minute, "SS" represents the second, and "00" represents the end identifier of the session timestamp. For example, the local session timestamp can be set to "2023080212035500".
[0045] S102. If it is determined that the current local session timestamp is equal to the first peer session timestamp and the first local sequence number is greater than the second peer sequence number stored locally, it is determined that the first transmission message passes the timing check, and the application data field in the first transmission message is obtained.
[0046] To Figure 2For example, device A is the data sender and device B is the data receiver. Device A sends transmission information to device B, and device B sends feedback information to device A. At the initial moment, after device A is first started, the local sequence number (TSN) of device A starts incrementing from A0, and the local session timestamp (TST) is the current system time a0 of device A. Since it has never received feedback information from device B before, for device A, the sequence number of device B stored locally, that is, the remote sequence number (RSN) stored locally, is 0, and the session timestamp of device B stored locally, that is, the remote session timestamp (RST) stored locally, is also 0. Device A sends the transmission information (TSNA0, 0, TSTa0, 0) to device B.
[0047] After device B obtains the transmission information (TSNA0, 0, TSTa0, 0), this transmission message is the last transmission message obtained by device B. Thus, the remote sequence number is extracted from this transmission message (for device B, its corresponding remote sequence number is actually the sequence number of device A) as A0 (i.e., RSNA0), and the remote session timestamp is extracted (for device B, its corresponding remote session timestamp is actually the session timestamp of device A) as a0 (i.e., RSTa0). At the same time, device B sends feedback information when its local sequence number is B0 (i.e., TSNB0) and its local session timestamp is b0 (i.e., TSTb0). Based on this, the feedback information (TSNB0, RSNA0, TSTb0, RSTa0) is constructed and sent to device A.
[0048] After the first interaction after startup is completed, after device A and device B obtain transmission data each time, they need to perform timing verification as described in the above technical solution. As described in the above technical solution, after device A obtains the feedback information (TSNB0, RSNA0, TSTb0, RSTa0) from device B, for device A, its current local session timestamp (i.e., a0) is compared with the remote session timestamp in the feedback information (i.e., the first remote session timestamp, which is a0), and it is determined that the current local session timestamp is equal to the first remote session timestamp. At the same time, the remote sequence number in the feedback information (i.e., the first local sequence number, which is B0) is compared with the remote sequence number stored locally (i.e., the second remote sequence number, which is 0 at this time), and it is determined that the first local sequence number is greater than the second remote sequence number stored locally.
[0049] After meeting the above two judgment conditions, it indicates that the feedback information passes the timing verification, and thus the user data field in the feedback information is obtained; wherein, the user data field may include a change identifier and application data; the change identifier indicates whether the security application data in the currently sent transmission message has changed compared with the security application data in the previously sent transmission message; the change identifier can be configured as 1 byte, for example, 0x55 indicates that the application data has changed; and the application data is the data body of the transmission message, which records the specific data information to be transmitted this time. For example, the application data may specifically include security application data.
[0050] Similarly, taking Figure 2 as an example, since device A has obtained the feedback information (TSNB0, RSNA0, TSTb0, RSTa0) of device B and the feedback information is valid after verification, device A extracts the other party's serial number (that is, the serial number of device B) as B0 (i.e., RSNB0), extracts the other party's session timestamp as b0 (i.e., RSTb0). At the same time, device A sends the transmission information again when its own serial number is A1 (i.e., TSNA1) and its own session timestamp is a0 (i.e., TSTa0). Based on this, the transmission information (TSNA1, RSNB0, TSTa0, RSTb0) is constructed and sent to device B.
[0051] After device B obtains the transmission information (TSNA1, RSNB0, TSTa0, RSTb0), for device B, it compares its own current local session timestamp (i.e., b0) with the other party's session timestamp in the transmission information (i.e., the first other party's session timestamp, which is b0), and thus determines that the current local session timestamp is equal to the first other party's session timestamp; at the same time, it compares the other party's serial number in the transmission information (i.e., the first local serial number, which is A1) with the other party's serial number stored locally (i.e., the second other party's serial number, which is A0), and thus determines that the first local serial number is greater than the second other party's serial number stored locally. Similarly, after meeting the above two judgment conditions, it indicates that the transmission information passes the timing verification, and thus the user data field in the transmission information is obtained.
[0052] Optionally, in the embodiment of the present invention, the first transmission message further includes at least one of a message header, a message tail, and a redundancy check field; the message header includes at least one of a source address, a destination address, a protocol version, a data length, and a data nature; the protocol version includes a communication protocol version and an application data version.
[0053] Specifically, in addition to the above timing verification field being used for security verification, the message header and message tail can also be configured in the transmitted message, and security verification is performed through the message header and message tail; the message header includes multiple data fields such as the source address, destination address, protocol version, data length, and data nature. For example, the source address, destination address, protocol version, data length, and data nature can be configured as 4 bytes, 4 bytes, 2 bytes, 4 bytes, and 2 bytes respectively.
[0054] The source address refers to the address information of the sending end of the transmitted message, and the destination address refers to the address information of the receiving end of the transmitted message; the protocol version includes the communication protocol version and the application data version. The communication protocol version refers to different defined versions of the communication protocol used by both communication parties, including the communication protocol field structure and the specific meanings of each field; the application data version refers to different defined versions of the application data exchanged by both communication parties, including the data structure and the specific meanings of each field; the data length represents the number of data bits of the current transmitted message.
[0055] The high byte part of the data nature can be used to indicate whether the device that sends the current transmitted message is available. For example, if the identity information of the device is the master device, the current transmitted message is available; if the identity information of the device is the standby device or other types of devices, the current transmitted message is unavailable; the low byte part of the data nature can be used to define the redundant channel. For example, when the data nature is configured as 2 bytes, the first bit of the low byte part is used to define whether to enable the redundant channel, and the remaining 7 bits are respectively used to define which redundant channel among redundant channels 1-7 is specifically activated.
[0056] Particularly, a certain number of reserved bytes (for example, 8 bytes) can also be reserved in the message header for storing other extended information; the message tail records the checksum generated using the check algorithm, and different check algorithms can be selected according to different check levels; the redundant check field is used for preliminary quick verification during redundant processing; accordingly, by configuring one or more of the message header, message tail, and redundant check field in the transmitted message, the security verification range of the transmitted message is extended, the orderly transmission of the transmitted message is ensured, and the accuracy of the data transmission result is improved.
[0057] Optionally, in the embodiment of the present invention, after determining that the current local session timestamp is equal to the first peer session timestamp and the first local sequence number is greater than the second peer sequence number stored locally, it further includes: obtaining the message transmission time according to the second local sequence number when obtaining the first transmitted message and the first peer sequence number, and comparing the message transmission time with a preset delay threshold; determining that the first transmitted message passes the timing verification includes: if it is determined that the message transmission time is less than or equal to the preset delay threshold, determining that the first transmitted message passes the timing verification.
[0058] Specifically, taking Figure 3 as an example, as described in the above technical solution, assume that the first transmission message is feedback information C sent by device B to device A, and this feedback information is specifically the feedback information of device B for transmission information D; device A receives feedback information C when its own sequence number is the second own sequence number (for example, AN), and the other party's sequence number in feedback information C (that is, the first other party's sequence number, for example, AM) actually reflects the sending time of transmission information D, that is, device A sends transmission information D when the sequence number is AM. Thus, from the time when device A sends transmission information D until it receives feedback information C, it is the message transmission time of this message.
[0059] Particularly, the difference between the second own sequence number AN and the first other party's sequence number AM represents the number of cycles corresponding to the message transmission process. Then, according to the product result of the unit cycle time and the number of cycles, the specific time of the message transmission process can be determined. The preset delay threshold is the maximum round-trip delay that the current device can tolerate when transmitting a message. Compare the message transmission time with the preset delay threshold. If the message transmission time is less than or equal to the preset delay threshold, it is determined that the first transmission message passes the timing check. Thus, each time a transmission message is received, message delay detection is realized, the existence of system cumulative delay is avoided, and at the same time, the interference of timeout transmission data on the data transmission timing is avoided, ensuring the timing accuracy of the data transmission process.
[0060] Optionally, in the embodiment of the present invention, after obtaining the timing check field of the first transmission message, it further includes: if it is determined that the current own session timestamp is not equal to the first other party's session timestamp, or the first own sequence number is less than or equal to the second other party's sequence number stored locally, or the message transmission time is greater than the preset delay threshold, it is determined that the first transmission message fails the timing check, and the first transmission message is discarded.
[0061] Specifically, as described in the above technical solution, if the current own session timestamp is not equal to the first other party's session timestamp, it means that there is a communication disconnection between device A and device B and the communication has been restored. The current transmission message is actually the accumulated data that was not sent before the communication disconnection, that is, the delayed data, resulting in different session timestamps; if the first own sequence number is less than or equal to the second other party's sequence number stored locally, it means that there is an out-of-order transmission phenomenon between device A and device B; if the message transmission time is greater than the preset delay threshold, it means that there is a communication delay phenomenon between device A and device B. The above behaviors will all cause the current transmission message to fail the timing check and thus discard the current transmission message, that is, do not save the other party's sequence number and the other party's session timestamp in the current transmission message, thereby further realizing the timing check of the transmission message and ensuring the timing accuracy of the data transmission process.
[0062] In the technical solution of the embodiment of the present invention, in response to obtaining a first transmission message, a timing verification field including a first local sequence number, a first peer sequence number, a first local session timestamp, and a first peer session timestamp is obtained; if it is determined that the current local session timestamp is equal to the first peer session timestamp and the first local sequence number is greater than the second peer sequence number stored locally, it is determined that the first transmission message passes the timing verification, and the application data field in the first transmission message is obtained. This not only improves the accuracy of the timing verification result, but also simplifies the timing verification process. Only one handshake behavior is required to establish a communication link, improving the link establishment efficiency.
[0063] Embodiment Two
[0064] Figure 4 FIG. is a flowchart of a data transmission method provided by Embodiment Two of the present invention. The relationship between this embodiment and the above embodiment is that only when there is updated data, the updated data configuration will be completed in the application data field, as Figure 4 shown. The method includes:
[0065] S201. In response to obtaining the updated data to be transmitted, configure the updated data in the application data field of the second transmission message, and send the second transmission message.
[0066] In order to implement data flow control, the above updated data can be configured in the application data field and the transmission message (i.e., the second transmission message) configured with the updated data can be sent only when the transmitted data changes, that is, when there is updated data; if there is no updated data, null data is configured in the application data field of the transmission message, that is, the byte value in the application data field is 0.
[0067] S202. If the feedback information of the second transmission message is not obtained, continue to send the second transmission message under the subsequent local sequence number until the feedback information of the second transmission message is obtained, then configure null data in the application data field of the third transmission message, and send the third transmission message.
[0068] To Figure 5For example, when the local sequence number of device A is 11, device A sends a second transmission message configured with N bytes of update data to device B. When the local sequence number of device A is 12, since the feedback information from device B for the second transmission message is not obtained, device A sends the second transmission message configured with N bytes of update data again when the local sequence number of device A is 12 to ensure that the update data can be received by device B. When the local sequence number of device A is 13, since the feedback information from device B for the second transmission message has been obtained, the above update data no longer exists in the transmission message (i.e., the third transmission message) sent by device A when the local sequence number of device A is 13. That is, the data in the application data field of the third transmission message is a null value. Until the next update data is obtained, the above update data is configured in the application data field of the transmission message, thereby reducing the network communication volume between devices and improving the data transmission efficiency between devices.
[0069] Optionally, in the embodiment of the present invention, the data transmission method further includes: if no valid transmission message is obtained within a preset time threshold, update the local session timestamp and send the updated local session timestamp; where the valid transmission message refers to a transmission message that passes the timing check.
[0070] Specifically, as Figure 6 shown, when the local sequence number of device A is 10 and the local session timestamp is a0, device A obtains the feedback information from device B, and the feedback information passes the timing check (i.e., "Right message"); when the local sequence number of device A is 11, device A also obtains the feedback information from device B, but the feedback information does not pass the timing check (i.e., "Wrong message"), obviously the feedback information is an invalid transmission message; device A continues to send the transmission information when the local sequence number of device A is 11; then when the local sequence number of device A is 12, device A also obtains the feedback information from device B, and the feedback information also does not pass the timing check (i.e., "Wrong message").
[0071] Device A continues to send a transmission message when its own sequence number is 12; then when its own sequence number is 13, Device A does not receive any feedback message from Device B (i.e., "No message"); the preset time threshold represents the judgment threshold for session disconnection due to communication failure. Assuming that the preset time threshold is the triggering time of two sequence numbers of Device A, that is, two cycle times, then within the time period from sequence number 11 to sequence number 13 of Device A, no valid transmission message is detected, indicating that the communication disconnection time between Device A and Device B has reached the preset time threshold. At this time, Device A can determine that its communication with Device B has been disconnected. After that, Device A updates its own session timestamp according to the local clock, that is, updates from a0 to a1. When its own sequence number is 13, Device A continues to send a transmission message so that Device B can obtain the updated session timestamp of Device A in a timely manner. In this way, through the detection of communication failure, the update and sending of the session timestamp are realized, ensuring that the peer device can obtain the updated session timestamp of the local party in a timely manner and ensuring the accuracy of the timing verification result.
[0072] For another example Figure 7 As shown, when its own sequence number is 91 and its own session timestamp is "2024030912000000", Device B sends a feedback message. When its own sequence number is 100, Device A sends a transmission message E and attaches the peer session timestamp "2024030912000000" to this transmission message E. However, due to network latency, there is a message hoarding phenomenon, and this transmission message E does not reach Device B on time; subsequently, when its own sequence number is 92 and its own session timestamp is "2024030912000000", Device B sends a feedback message again, and also sends a feedback message when its own sequence number is 93 and its own session timestamp is "2024030912000000", and also sends a feedback message when its own sequence number is 93 and its own session timestamp is "2024030912000000".
[0073] When its own sequence number is 95, since Device B has not received the transmission message sent by Device A for a long time, based on the judgment conditions disclosed in the above technical solution, it can be determined that the communication between Device B and Device A is interrupted. At this time, Device B updates its own session timestamp to "2024030915301000". Thus, when its own sequence number (i.e., the local sequence number) is 95 and its own session timestamp (i.e., the local session timestamp) is "2024030915301000", Device B sends a feedback message F.
[0074] After the serial number of Device A reaches its maximum value, it returns to the initial value 1. When the serial number is 97 again, the communication with Device B is restored. At this time, the local serial number of Device A is 97, and the session timestamp of the other party is "2024030915301000". After a long time, the above transmission information E reaches Device B. After obtaining the transmission information E, Device B compares the session timestamp of the other party in the transmission information E with the current local session timestamp, and compares the first local serial number in the transmission information E with the stored serial number of the other party locally. Since the current local session timestamp is not equal to the first session timestamp of the other party in the transmission information E, it is considered that the transmission information E is actually a retransmitted message accumulated in the network. The transmission information E fails the timing check, and the transmission information E is discarded.
[0075] In the technical solution of the embodiment of the present invention, in response to obtaining the update data to be transmitted, the update data is configured in the application data field of the second transmission message, and the second transmission message is sent. If the feedback information of the second transmission message is not obtained, the second transmission message is continuously sent under the subsequent local serial number until the feedback information of the second transmission message is obtained, and the null data is configured in the application data field of the third transmission message, and the third transmission message is sent. In this way, the network communication volume between devices is reduced, and the data transmission efficiency between devices is improved.
[0076] Embodiment III
[0077] Figure 8 It is a flowchart of a data transmission method provided by Embodiment III of the present invention. The relationship between this embodiment and the above embodiments is that, according to the serial number, session timestamp, and message transmission time, they are jointly used as the timing check conditions. As Figure 8 shown, the method includes:
[0078] S301. In response to obtaining the first transmission message, obtain the timing check field of the first transmission message; wherein, the timing check field includes the first local serial number, the first serial number of the other party, the first local session timestamp, and the first session timestamp of the other party; execute S302.
[0079] S302. Determine whether the current local session timestamp is equal to the first session timestamp of the other party; if so, execute S303; if not, execute S307.
[0080] S303. Determine whether the first local serial number is greater than the second serial number of the other party stored locally; if so, execute S304; if not, execute S307.
[0081] S304. According to the second local serial number when the first transmission message is obtained, and the first serial number of the other party, obtain the message transmission time; execute S305.
[0082] S305. Determine whether the message transmission time is less than or equal to a preset delay threshold. If so, execute S306; if not, execute S307.
[0083] S306. Determine that the first transmission message passes the timing check, and obtain the application data field in the first transmission message.
[0084] S307. Determine that the first transmission message fails the timing check, and discard the first transmission message.
[0085] In the technical solution of the embodiment of the present invention, the serial number, the session timestamp, and the message transmission time are used as the timing check conditions, which not only improves the accuracy of the timing check result, but also simplifies the timing check process. Only one handshake behavior is required to establish a communication link, improving the link establishment efficiency.
[0086] Embodiment 4
[0087] Figure 9 FIG. is a structural block diagram of a data transmission device provided in Embodiment 4 of the present invention, which specifically includes:
[0088] A timing check field acquisition module 401, configured to, in response to obtaining a first transmission message, obtain the timing check field of the first transmission message; wherein, the timing check field includes a first local serial number, a first remote serial number, a first local session timestamp, and a first remote session timestamp;
[0089] An application data field acquisition module 402, configured to, if it is determined that the current local session timestamp is equal to the first remote session timestamp, and the first local serial number is greater than the second remote serial number stored locally, determine that the first transmission message passes the timing check, and obtain the application data field in the first transmission message.
[0090] In the technical solution of the embodiment of the present invention, in response to obtaining a first transmission message, obtain a timing check field including a first local serial number, a first remote serial number, a first local session timestamp, and a first remote session timestamp; if it is determined that the current local session timestamp is equal to the first remote session timestamp, and the first local serial number is greater than the second remote serial number stored locally, determine that the first transmission message passes the timing check, and obtain the application data field in the first transmission message. Thereby, not only the accuracy of the timing check result is improved, but also the timing check process is simplified. Only one handshake behavior is required to establish a communication link, improving the link establishment efficiency.
[0091] Optionally, the data transmission device is further configured to obtain a message transmission time according to a second local sequence number when the first transmission message is obtained and the first peer sequence number, and compare the message transmission time with a preset delay threshold; if it is determined that the message transmission time is less than or equal to the preset delay threshold, it is determined that the first transmission message passes the timing check.
[0092] Optionally, the data transmission device is further configured to, if it is determined that the current local session timestamp is not equal to the first peer session timestamp, or the first local sequence number is less than or equal to a second peer sequence number stored locally, or the message transmission time is greater than the preset delay threshold, determine that the first transmission message fails the timing check and discard the first transmission message.
[0093] Optionally, the first transmission message further includes at least one of a message header, a message tail, and a redundancy check field; the message header includes at least one of a source address, a destination address, a protocol version, a data length, and a data nature; the protocol version includes a communication protocol version and an application data version.
[0094] Optionally, the data transmission device is further configured to, in response to obtaining update data to be transmitted, configure the update data in the application data field of a second transmission message and send the second transmission message; if the feedback information of the second transmission message is not obtained, continue to send the second transmission message under the subsequent local sequence number until the feedback information of the second transmission message is obtained, and configure null data in the application data field of a third transmission message and send the third transmission message.
[0095] Optionally, the data transmission device is further configured to, if no valid transmission message is obtained within a preset time threshold, update the local session timestamp and send the updated local session timestamp; wherein, the valid transmission message refers to a transmission message that passes the timing check.
[0096] The above device can execute the data transmission method provided by any embodiment of the present invention, and has corresponding functional modules and beneficial effects for executing the method. Technical details not described in detail in this embodiment can be referred to the data transmission method provided by any embodiment of the present invention.
[0097] Embodiment 5
[0098] Figure 10The structural schematic diagram of an electronic device 10 that can be used to implement the embodiments of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, electronic devices, blade electronic devices, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.
[0099] As Figure 10 shown, the electronic device 10 includes at least one processor 11 and a memory communicatively connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc. The memory stores a computer program executable by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. The input / output (I / O) interface 15 is also connected to the bus 14.
[0100] Multiple components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0101] The processor 11 can be various general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various dedicated artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the data transmission method.
[0102] In some embodiments, the data transmission method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as a storage unit. In some embodiments, part or all of the computer program may be loaded and / or installed onto the heterogeneous hardware accelerator via the ROM and / or the communication unit. When the computer program is loaded into the RAM and executed by the processor, one or more steps of the data transmission method described above may be performed. Alternatively, in other embodiments, the processor may be configured to execute the data transmission method by any other suitable means (e.g., by means of firmware).
[0103] The various embodiments of the systems and techniques described above in this document may be implemented in digital electronic circuitry, integrated circuit systems, field programmable gate arrays (FPGA), application specific integrated circuits (ASIC), application specific standard products (ASSP), system on a chip (SOC), complex programmable logic devices (CPLD), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include: being implemented in one or more computer programs that may be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a special-purpose or general-purpose programmable processor that may receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit the data and instructions to the storage system, the at least one input device, and the at least one output device.
[0104] The computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs may be executed entirely on the machine, partly on the machine, as a stand-alone software package partly on the machine and partly on a remote machine, or entirely on the remote machine or electronic device.
[0105] In the context of the present invention, a computer-readable storage medium can be a tangible medium that can contain or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. The computer-readable storage medium can include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination of the foregoing. Alternatively, the computer-readable storage medium can be a machine-readable signal medium. More specific examples of the machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or Flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0106] To provide for interaction with a user, the systems and techniques described herein can be implemented on a heterogeneous hardware accelerator that has: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which the user can provide input to the heterogeneous hardware accelerator. Other kinds of devices can also be used to provide for interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, speech input, or tactile input).
[0107] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data electronic device), or a computing system that includes middleware components (e.g., an application electronic device), or a computing system that includes front-end components (e.g., a user computer having a graphical user interface or a web browser through which the user can interact with an implementation of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0108] A computing system may include a client and an electronic device. The client and the electronic device are generally far from each other and usually interact via a communication network. The relationship between the client and the electronic device is generated by computer programs running on respective computers and having a client-electronic device relationship with each other. The electronic device may be a cloud electronic device, also known as a cloud computing electronic device or a cloud host, which is a host product in a cloud computing service system, and solves the defects of difficult management and weak business scalability existing in traditional physical hosts and VPS services.
[0109] It should be understood that various forms of processes shown above can be used, steps can be reordered, added or deleted. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and no limitation is made herein.
[0110] The above specific embodiments do not constitute a limitation on the protection scope of the present invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principle of the present invention shall be included within the protection scope of the present invention.
Claims
1. A data transmission method, characterized in that: include: In response to obtaining the first transmission message, obtaining a timing check field of the first transmission message; wherein the timing check field includes a first own-party sequence number, a first other-party sequence number, a first own-party session timestamp, and a first other-party session timestamp; If it is determined that the current local session timestamp is equal to the first other party session timestamp, and the first local sequence number is greater than the second other party sequence number stored locally, it is determined that the first transmission message passes the timing check, and the application data field in the first transmission message is obtained.
2. The method according to claim 1, characterized in that After determining that the current local session timestamp is equal to the first other party session timestamp and the first local sequence number is greater than the locally stored second other party sequence number, the method further includes: Acquire a message transmission time according to the second own-party sequence number when the first transmission message is acquired and the first other-party sequence number, and compare the message transmission time with a preset delay threshold; The determining that the first transmission message passes the timing check includes: If it is determined that the message transmission time is less than or equal to the preset delay threshold, it is determined that the first transmission message passes the timing check.
3. The method according to claim 2, characterized in that After acquiring the timing check field of the first transmission message, the method further includes: If it is determined that the current local session timestamp is not equal to the first other party session timestamp, or the first local sequence number is less than or equal to the locally stored second other party sequence number, or the message transmission time is greater than a preset delay threshold, it is determined that the first transmission message fails the timing check and the first transmission message is abandoned.
4. The method according to claim 1, characterized in that: The first transmission message also includes at least one of a message header, a message trailer and a redundancy check field; the message header includes at least one of a source address, a destination address, a protocol version, a data length and a data property; the protocol version includes a communication protocol version and an application data version.
5. The method according to claim 1, characterized in that The data transmission method further includes: In response to acquiring the update data to be transmitted, configuring the update data in the application data field of the second transmission message, and sending the second transmission message; If the feedback information of the second transmission message is not obtained, the second transmission message will continue to be sent under the subsequent sequence number of the party until the feedback information of the second transmission message is obtained, and the null value data will be configured in the application data field of the third transmission message, and the third transmission message will be sent.
6. The method according to claim 1, characterized in that The data transmission method further includes: If no valid transmission message is obtained within the preset time threshold, the local session timestamp is updated and the updated local session timestamp is issued; wherein the valid transmission message refers to a transmission message that passes the timing check.
7. A data transmission device, characterized in that: include: A timing check field acquisition module, configured to acquire a timing check field of the first transmission message in response to acquiring the first transmission message; wherein the timing check field includes a first own-party sequence number, a first other-party sequence number, a first own-party session timestamp, and a first other-party session timestamp; An application data field acquisition module is used to determine that the first transmission message passes the timing check if it is determined that the current own session timestamp is equal to the first other party session timestamp, and the first own sequence number is greater than the second other party sequence number stored locally, and obtain the application data field in the first transmission message.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the data transmission method according to any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the data transmission method according to any one of claims 1 to 6 when executed.
10. A computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the computer program implements the data transmission method according to any one of claims 1 to 6.