CN111327687B - Data transmission method and device, electronic equipment and storage medium - Google Patents

Data transmission method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111327687B
CN111327687B CN202010072168.9A CN202010072168A CN111327687B CN 111327687 B CN111327687 B CN 111327687B CN 202010072168 A CN202010072168 A CN 202010072168A CN 111327687 B CN111327687 B CN 111327687B
Authority
CN
China
Prior art keywords
data
sent
data packet
sending end
packet
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202010072168.9A
Other languages
Chinese (zh)
Other versions
CN111327687A (en
Inventor
王贵喜
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhuomi Private Ltd
Original Assignee
Zhuomi Private Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhuomi Private Ltd filed Critical Zhuomi Private Ltd
Priority to CN202010072168.9A priority Critical patent/CN111327687B/en
Publication of CN111327687A publication Critical patent/CN111327687A/en
Application granted granted Critical
Publication of CN111327687B publication Critical patent/CN111327687B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/143Termination or inactivation of sessions, e.g. event-controlled end of session
    • H04L67/145Termination or inactivation of sessions, e.g. event-controlled end of session avoiding end of session, e.g. keep-alive, heartbeats, resumption message or wake-up for inactive or interrupted session
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • H04L43/106Active monitoring, e.g. heartbeat, ping or trace-route using time related information in packets, e.g. by adding timestamps
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/16Threshold monitoring
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2212/00Encapsulation of packets
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L2463/00Additional details relating to network architectures or network communication protocols for network security covered by H04L63/00
    • H04L2463/121Timestamp

Abstract

The embodiment of the invention provides a data transmission method, a data transmission device, electronic equipment and a storage medium. The scheme is as follows: a sending end acquires data to be sent, and packages the data to be sent to obtain a data packet to be sent; and the data packet to be sent carries a data identifier, the data identifier comprises timestamp information of the data to be sent and address information of the sending end, and the data packet to be sent is sent to the receiving end, so that the receiving end sequences the received data packets to be sent according to the data identifier carried by each received data packet to be sent. According to the technical scheme provided by the embodiment of the invention, the data identification carried by each data packet is composed of the timestamp information of the data to be sent and the address information of the sending end, so that the uniqueness of the data identification carried by each data packet is greatly improved, the repetition rate of the data identification carried by the data packet is reduced, the data sequencing accuracy of the receiving end is improved, and the data ordering is effectively maintained.

Description

Data transmission method and device, electronic equipment and storage medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a data transmission method and apparatus, an electronic device, and a storage medium.
Background
In the data transmission process, in order to ensure the ordering of each received data, when the sending end sends the data to the receiving end, a sequence (order) field is carried in the data, and the sequence field is formed by timestamp information. After receiving the data sent by the sending end, the receiving end extracts the sequence field from the received data, so that the data is sequenced according to the sequence field, and the ordering of the data is ensured.
However, with the increasing of the data transmission amount, especially the data concurrency amount, the repetition rate of the sequence field carried in the data is greatly increased, and the data ordering is disturbed.
Disclosure of Invention
Embodiments of the present invention provide a data transmission method, an apparatus, an electronic device, and a storage medium, so as to improve accuracy of data sorting at a receiving end and maintain data ordering. The specific technical scheme is as follows:
the embodiment of the invention provides a data transmission method, which is applied to a sending end and comprises the following steps:
acquiring data to be transmitted;
packaging the data to be sent to obtain a data packet to be sent; the data packet to be sent carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of the sending end;
and sending the data packets to be sent to a receiving end so that the receiving end sequences the received data packets to be sent according to the data identification carried by each received data packet to be sent.
Optionally, the data identifier further includes attribute information and a preset value of the sending end.
Optionally, the data packet to be sent also carries a first length value, where the first length value is used to indicate the length of the data to be sent.
Optionally, the method further includes:
if the sending end is in long connection with the receiving end, sending a heartbeat packet containing a preset character string to the receiving end according to a preset time interval, so that the receiving end determines that the long connection with the sending end is not interrupted according to the received heartbeat packet.
Optionally, the second length value of the preset character string is smaller than a preset length threshold.
The embodiment of the invention also provides a data transmission method which is applied to a receiving end and comprises the following steps:
receiving a data packet to be sent by a sending end, wherein the data packet to be sent is obtained by encapsulating acquired data to be sent by the sending end, and carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of the sending end;
and sequencing the received data packets to be sent according to the data identification carried by each received data packet to be sent.
Optionally, the data identifier further includes attribute information and a preset value of the sending end.
Optionally, the data packet to be sent also carries a first length value, where the first length value is used to indicate the length of the data to be sent;
the method further comprises the following steps:
decapsulating the received data packet to be sent to obtain target data;
and according to the sequencing result of each data packet to be sent by the same sending end, reading data matched with the first length value carried by each data packet to be sent from the target data to obtain the data to be sent.
Optionally, the method further includes:
receiving a heartbeat packet which is sent by the sending end and contains a preset character string, wherein when the heartbeat packet is in long connection with the receiving end, the client end sends the heartbeat packet to the receiving end according to a preset time interval;
and determining that the long connection with the sending end is not interrupted based on the heartbeat packet.
Optionally, the second length value of the preset character string is smaller than a preset length threshold.
An embodiment of the present invention further provides a data transmission apparatus, applied to a sending end, where the apparatus includes:
the acquisition module is used for acquiring data to be transmitted;
the encapsulation module is used for encapsulating the data to be sent to obtain a data packet to be sent; the data packet to be sent carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of the sending end;
the first sending module is configured to send the data packets to be sent to a receiving end, so that the receiving end sorts the received data packets to be sent according to the data identifier carried by each received data packet to be sent.
Optionally, the data identifier further includes attribute information and a preset value of the sending end.
Optionally, the data packet to be sent also carries a first length value, where the first length value is used to indicate the length of the data to be sent.
Optionally, the apparatus further comprises:
and the second sending module is used for sending a heartbeat packet containing a preset character string to the receiving end according to a preset time interval if the sending end is in long connection with the receiving end, so that the receiving end determines that the long connection with the sending end is not interrupted according to the received heartbeat packet.
Optionally, the second length value of the preset character string is smaller than a preset length threshold.
The embodiment of the invention also provides a data transmission device, which is applied to a receiving end, and the device comprises:
a first receiving module, configured to receive a to-be-sent data packet sent by a sending end, where the to-be-sent data packet is obtained by encapsulating, by the sending end, acquired to-be-sent data, and the to-be-sent data packet carries a data identifier, where the data identifier includes timestamp information of the to-be-sent data and address information of the sending end;
and the sequencing module is used for sequencing the received data packets to be sent according to the data identification carried by each received data packet to be sent.
Optionally, the data identifier further includes attribute information and a preset value of the sending end.
Optionally, the data packet to be sent also carries a first length value, where the first length value is used to indicate the length of the data to be sent;
the device further comprises:
the de-encapsulation module is used for de-encapsulating the received data packet to be sent to obtain target data;
and the reading module is used for reading data matched with the first length value carried by each data packet to be sent from the target data according to the sequencing result of each data packet to be sent by the same sending end to obtain the data to be sent.
Optionally, the apparatus further comprises:
the second receiving module is used for receiving a heartbeat packet which is sent by the sending end and contains a preset character string, and when the heartbeat packet is in long connection with the receiving end, the client end sends the heartbeat packet to the receiving end according to a preset time interval;
and the determining module is used for determining that the long connection with the sending end is not interrupted based on the heartbeat packet.
Optionally, the second length value of the preset character string is smaller than a preset length threshold.
The embodiment of the invention also provides electronic equipment which comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;
a memory for storing a computer program;
and the processor is used for realizing any one of the steps of the data transmission method when executing the program stored in the memory.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and when the computer program is executed by a processor, the method implements any of the above steps of the data transmission method.
Embodiments of the present invention further provide a computer program product containing instructions, which when run on a computer, cause the computer to execute any of the above-mentioned data transmission methods.
The embodiment of the invention has the following beneficial effects:
in the data transmission method, the data transmission device, the electronic device and the storage medium provided by the embodiment of the invention, the data packet sent by the sending end to the receiving end carries the data identifier, so that the receiving end can directly sequence the received data packet according to the data identifier after receiving the data packet sent by the sending end. Because the data identification carried by each data packet is composed of the timestamp information of the data to be sent and the address information of the sending end, the uniqueness of the data identification carried by each data packet is greatly improved, the repetition rate of the data identification carried by the data packet is reduced, the data sequencing accuracy of the receiving end is improved, and the data ordering is effectively maintained.
Of course, it is not necessary for any product or method to achieve all of the above-described advantages at the same time for practicing the invention.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
Fig. 1 is a first flowchart of a data transmission method according to an embodiment of the present invention;
fig. 2 is a schematic flowchart of a data transmission method according to a second embodiment of the present invention;
fig. 3 is a schematic diagram illustrating a third flowchart of a data transmission method according to an embodiment of the present invention;
fig. 4 is a fourth flowchart illustrating a data transmission method according to an embodiment of the present invention;
FIG. 5-a is a diagram illustrating normal transmission of a data packet according to an embodiment of the present invention;
FIG. 5-b is a first schematic diagram of abnormal transmission of data packets according to an embodiment of the present invention;
FIG. 5-c is a second schematic diagram of abnormal transmission of data packets according to an embodiment of the present invention;
fig. 6 is a schematic flowchart of a fifth method for transmitting data according to an embodiment of the present invention;
fig. 7 is a signaling diagram of a data transmission process according to an embodiment of the present invention;
fig. 8 is a schematic diagram of a first structure of a data transmission apparatus according to an embodiment of the present invention;
fig. 9 is a schematic diagram of a second structure of a data transmission apparatus according to an embodiment of the present invention;
fig. 10 is a schematic structural diagram of an electronic device according to an embodiment of the invention;
fig. 11 is a schematic structural diagram of a second electronic device according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In order to solve the problem of disordered data sequencing caused by high repetition rate of sequence fields carried by data in the existing data transmission process, the embodiment of the invention provides a data transmission method. The method can be applied to any electronic equipment, and the electronic equipment can be a sending end and a receiving end. In the method provided by the embodiment of the invention, a sending end acquires data to be sent, and packages the data to be sent to obtain a data packet to be sent; and the data packet to be sent carries a data identifier, the data identifier comprises timestamp information of data to be sent and address information of the sending end, and the data packet to be sent is sent to the receiving end, so that the receiving end sorts the received data packets to be sent according to the data identifier carried by each received data packet to be sent.
By the method provided by the embodiment of the invention, the data packet sent by the sending end to the receiving end carries the data identifier, so that the receiving end can directly sequence the received data packet according to the data identifier after receiving the data packet sent by the sending end. Because the data identification carried by each data packet is composed of the timestamp information of the data to be sent and the address information of the sending end, the uniqueness of the data identification carried by each data packet is greatly improved, and the repetition rate of the data identification carried by the data packet is reduced, so that the accuracy of data sequencing of the receiving end is improved, and the data order is effectively maintained.
The following examples illustrate the present invention.
As shown in fig. 1, fig. 1 is a first flowchart of a data transmission method according to an embodiment of the present invention. The method is applied to a transmitting end and specifically comprises the following steps.
Step S101, data to be sent is obtained.
In this embodiment of the present invention, the sending end may be a client or a server. Here, the transmitting end is not particularly limited.
In an optional embodiment, the data to be sent may be data stored locally at the sending end. For example, in the process of live video, if the sending end is a server, that is, a live broadcast server, the data to be sent may be data sent by an anchor client or a viewer client. The live broadcast server can directly acquire data to be transmitted from locally stored data.
Step S102, packaging data to be transmitted to obtain a data packet to be transmitted; the data packet to be sent carries a data identifier, and the data identifier includes timestamp information of the data to be sent and address information of the sending end.
In this step, after the data to be sent is obtained, the sending end may perform encapsulation processing on the data to be sent to obtain a data packet to be sent. Namely, data to be sent is packed, and the data packet obtained by packing is taken as a data packet to be sent. Here, the specific method of data encapsulation is not particularly limited.
And the timestamp information of the data to be sent is the time information corresponding to the obtained data to be sent. The address information of the transmitting end may be a Media Access Control (MAC) address and/or an Internet Protocol (IP) address of the transmitting end. The timestamp information carried in the data representation may be specifically represented as a timestamp field composed of a preset number of digits. Here, the timestamp information carried in the data identifier is not specifically described.
In an optional embodiment, the data packet to be sent further carries a first length value, where the first length value is used to indicate a length of data to be sent. For a specific description of the first length value carried by the data packet to be transmitted, reference may be made to the following description, and no specific description is made here.
For ease of understanding, the data packet to be transmitted is described by taking table 1 as an example.
TABLE 1
Length value 1 Length value 2 Instructions Class two Self-defining Data identification Bag body
1 4 1 1 1 4 -
In the data packet to be sent shown in table 1, the data packet to be sent mainly includes two parts, namely, a data packet header and a data packet body. The packet header of the data packet comprises a length value 1, a length value 2, an instruction, a secondary class, a user-defined identifier and a data identifier which are shown in a table 1, and the packet body of the data packet is shown in the table 1.
The length value 1 is a length value of a header file of a data packet to be sent, and may be recorded as a header length (headerrlength), where the number of bytes occupied by the header length may be 1.
The length value 2 is the first length value, and may be recorded as a packet length (body length), and the number of bytes occupied by the packet length may be 4.
The command (Cmd) is used for indicating the service type or state corresponding to the data to be sent. The number of bytes occupied by the instruction may be 1.
The secondary category (SubType) is used for further indicating the category corresponding to the data to be sent. Taking instant messaging as an example, the secondary category may be used to indicate which of voice data, text data, or image data is data to be sent. The number of bytes occupied by the secondary class can be 1.
The above-mentioned custom (DiyType) is used to indicate a service that requires special processing, for example, a red envelope service or the like. The number of bytes occupied by the user-defined can be 1.
The data identification (DataID) includes timestamp information of the data to be transmitted and address information of a transmitting end. The number of bytes occupied by the data identifier can be 4.
The body (body conntent) is the data to be transmitted. Wherein, -represents an indeterminate value. The number of bytes occupied by the bag body needs to be determined according to the actual situation of the data to be sent.
Step S103, sending the data packets to be sent to the receiving end, so that the receiving end sorts the received data packets to be sent according to the data identifier carried by each received data packet to be sent.
In this step, the sending end may send the data packet to be sent to the receiving end. After receiving the data packet to be sent by the sending end, the receiving end may sort the received data packets to be sent according to the data identifier carried in the packet header of the data packet. The specific method for sorting can be referred to the following description, and is not specifically described here.
By adopting the method shown in fig. 1, the data packet sent by the sending end to the receiving end carries the data identifier, so that the receiving end can directly sequence the received data packets according to the data identifier after receiving the data packet sent by the sending end. Because the data identification carried by each data packet is composed of the timestamp information of the data to be sent and the address information of the sending end, the uniqueness of the data identification carried by each data packet is greatly improved, and the repetition rate of the data identification carried by the data packet is reduced, so that the accuracy of data sequencing of the receiving end is improved, and the data order is effectively maintained.
In an optional embodiment, the data identifier may further include attribute information and a preset value of the sending end. The attribute information of the sending end includes, but is not limited to, a version number of the sending end and an ID corresponding to the service type. The preset value may be a natural number of self-increment.
In the embodiment of the invention, compared with the data packet to be sent which only contains the address information of the sending end and the timestamp information of the data to be sent, the data packet to be sent which also contains the attribute information of the sending end and the preset numerical value contains more abundant information, so that a plurality of data packets to be sent which are sent by the same sending end at the same time can be more accurately distinguished, the uniqueness of the data identification carried in each data packet is further improved, the repetition rate of the data identification carried by the data packet is reduced, the data sequencing accuracy of the receiving end is improved, and the data orderliness is maintained.
In an optional embodiment, according to the method shown in fig. 1, an embodiment of the present invention further provides a data transmission method. As shown in fig. 2, fig. 2 is a second flowchart of a data transmission method according to an embodiment of the present invention. The method is applied to the transmitting end and specifically comprises the following steps.
Step S201, data to be transmitted is acquired.
Step S202, packaging data to be transmitted to obtain a data packet to be transmitted; the data packet to be sent carries a data identifier, and the data identifier includes timestamp information of the data to be sent and address information of the sending end.
Step S203, sending data packets to be sent to the receiving end, so that the receiving end sorts the received data packets to be sent according to the data identifier carried by each received data packet to be sent.
The above steps S201 to S203 are the same as the above steps S101 to S103.
Step S204, if the sending end is in long connection with the receiving end, sending a heartbeat packet containing a preset character string to the receiving end according to a preset time interval, so that the receiving end determines that the long connection with the sending end is not interrupted according to the received heartbeat packet.
In this step, when the sending end and the receiving end are connected for a long time, the sending end can send a heartbeat packet containing a preset character string to the receiving end according to a preset time interval. Upon receiving the heartbeat packet, the receiving end can determine that the long connection with the transmitting end is not interrupted.
In the embodiment of the invention, when the sending end and the receiving end are in long connection, as the sending end and the receiving end may not be in the data interaction process all the time, in order to determine whether the sending end and the receiving end maintain the long connection state all the time, the sending end can maintain the heartbeat service of the sending end and the receiving end by sending the heartbeat packet containing the preset character string to the receiving end, and the timeliness and the accuracy of the determination of the long connection state between the sending end and the receiving end are ensured.
The above step S204 may be performed before or after any of the above steps S201 to S203.
In an optional embodiment, the second length value of the preset character string is smaller than a preset length threshold.
In the embodiment of the present invention, since transmission of the data packet needs to consume a certain flow and electric quantity, when the second length value of the preset character string included in the heartbeat packet sent by the sending end to the receiving end is smaller than the preset length threshold, on the premise of maintaining the heartbeat service, the electric quantity flow consumed by the sending end is saved.
In the above embodiment, the heartbeat packet is sent from the sending end to the receiving end. In addition, the heartbeat packet may be transmitted from the receiving end to the transmitting end, and will not be described in detail here.
Based on an inventive concept, according to the data transmission method provided by the embodiment of the invention, the embodiment of the invention also provides a data transmission method. As shown in fig. 3, fig. 3 is a third schematic flow chart of the data transmission method according to the embodiment of the present invention. The method is applied to the receiving end and specifically comprises the following steps.
Step S301, receiving a to-be-sent data packet sent by a sending end, where the to-be-sent data packet is obtained by encapsulating, by the sending end, acquired to-be-sent data, and the to-be-sent data packet carries a data identifier, where the data identifier includes timestamp information of the to-be-sent data and address information of the sending end.
In this step, after obtaining the data to be sent, the sending end may encapsulate the data to be sent to obtain a data packet to be sent, and send the data packet to be sent to the receiving end. And the receiving end receives the data packet to be sent.
Step S302, according to the data identification carried by each received data packet to be sent, the received data packets to be sent are sequenced.
In this step, after receiving the data packet to be sent by the sending end, the receiving end may sequence the received data packet to be sent according to the data identifier carried in the packet header of the data packet to be sent.
The data packet to be sent received by the receiving end may be sent by one sending end or may be sent by multiple sending ends.
By using the method shown in fig. 3, the data packet sent by the sending end to the receiving end carries the data identifier, so that the receiving end can directly sequence the received data packets according to the data identifier after receiving the data packet sent by the sending end. Because the data identification carried by each data packet is composed of the timestamp information of the data to be sent and the address information of the sending end, the uniqueness of the data identification carried by each data packet is greatly improved, the repetition rate of the data identification carried by the data packet is reduced, the data sequencing accuracy of the receiving end is improved, and the data ordering is effectively maintained.
In an optional embodiment, in step S302, according to the data identifier carried by each received data packet to be sent, the received data packets to be sent are sorted, which may specifically be represented as:
and comparing the timestamp information and/or the address information of each data packet to be sent based on the preset priority corresponding to the address information aiming at each received data packet to be sent, and determining the sequence of each received data packet to be sent.
For example, there are 2 sending ends sending data packets to be sent, i.e. data packet 1 and data packet 2, to a receiving end. The address information of the data identifier carried by the data packet 1 is different from the address information of the data identifier carried by the data packet 2, but at least the following situations exist in the time stamp information carried by the data packets 1 and 2:
in case one, the time corresponding to the timestamp information carried by the data packet 1 is later than the time corresponding to the timestamp information carried by the data packet 2.
In case two, the time corresponding to the timestamp information carried by the data packet 1 is equal to the time corresponding to the timestamp information carried by the data packet 2.
In case three, the time corresponding to the timestamp information carried by the data packet 1 is earlier than the time corresponding to the timestamp information carried by the data packet 2.
For the first and third cases, the receiving end may accurately determine the sorting result corresponding to the data packet 1 and the data packet 2 by comparing the timestamp information carried by the data packet 1 with the timestamp information carried by the data packet 2.
In the second situation, after comparing the timestamp information carried by the data packet 1 with the timestamp information carried by the data packet 2, the receiving end cannot determine the ordering result corresponding to the data packet 1 and the data packet 2. At this time, the receiving end may determine the ordering result corresponding to the data packet 1 and the data packet 2 according to the first priority of the address information carried by the data packet 1 and the second priority of the address information carried by the data packet 2.
For example, the first priority of the address information carried by the data packet 1 is greater than the second priority of the address information carried by the data packet 2, and the receiving end may determine that the ordering result of the data packet 1 is higher than the ordering result of the data packet 2.
In another optional implementation, in step S302, according to the data identifier carried by each received data packet to be sent, the received data packets to be sent are sorted, which may be specifically represented as:
and comparing the timestamp information and/or the address information of each data packet to be sent aiming at each received data packet to be sent, and determining the sequence of each received data packet to be sent.
The above-described packet 1 and packet 2 are also described as examples. For the above first and third cases, the ordering results corresponding to the data packets 1 and 2 can still be determined in the above manner. For the second case, when the sorting result cannot be determined according to the timestamp information, the receiving end may directly compare the sizes of the address information carried by the data packet 1 and the address information carried by the data packet 2, so as to determine the sorting results corresponding to the data packets 1 and 2.
For example, the address of the sender corresponding to the data packet 1 is 0.0.0.0, the address information carried by the data packet 1 is denoted as 0000, the address of the sender corresponding to the data packet 2 is 0.0.0.1, and the address information carried by the data packet 2 is denoted as 0001, and 0000< -0001, so that the receiving end may determine that the ordering result of the data packet 1 is higher than the ordering result of the data packet 2.
In the embodiment of the present invention, in the step S302, when the receiving end sequences each received data packet to be sent, the receiving end preferentially considers the timestamp information carried by each received data packet to be sent.
In an optional embodiment, the data identifier may further include attribute information and a preset value of the sending end.
Because the data concurrent transmission amount is large in the data transmission process, the timestamp information carried by a plurality of data packets to be transmitted sent from a certain sending end to a receiving end is the same. After receiving the data packets sent by the sending end, the receiving end can not accurately determine the sequencing result of each data packet to be sent only according to the timestamp information and the address information carried in the data identifier. At this time, the receiving end may sort the received data packets to be sent according to other information carried in the received data packets to be sent, that is, the attribute information and the preset value.
The data identifier further includes the preset value as an example for explanation. If the preset value is the natural number of the self-increment, the current sending end sends 5 data packets, namely the data packets 1 to 5 data packets, to the sending end. The timestamp information and the address information carried by each data packet are the same, but the preset value carried by each data packet is sequentially increased, for example, the preset value carried by the data packet 1 is 1, the preset value carried by the data packet 2 is 2, the preset value carried by the data packet 3 is 3, the preset value carried by the data packet 4 is 4, the preset value carried by the data packet 5 is 5, the 1-2-3-restricted type is restricted to 5. Therefore, the receiving end may determine that the ordering results of the data packets 1 to 5 are: packet 1, packet 2, packet 3, packet 4, and packet 5.
In an optional embodiment, if the sending end is a service end and the receiving end is a client end, the sending end and the receiving end are applied to an instant messaging process, and after the receiving end sorts received data packets to be sent, each data packet to be sent is encapsulated to obtain the data to be sent, and each data to be sent is displayed according to a sorting result of each data packet to be sent.
For ease of understanding, the above-mentioned data packets 1 to 5 are still used as examples for illustration. And if the data to be sent corresponding to the data packets 1 to 5 correspond to the data packets 1 to 5, the data to be sent corresponds to the data packets 1 to 5. The receiving end determines the sequencing results of the data packets 1-5 as follows in sequence: after the data packet 1, the data packet 2, the data packet 3, the data packet 4 and the data packet 5, the receiving end can display in sequence in the display interface of the instant messaging software: data 1, data 2, data 3, data 4, and data 5.
In an optional embodiment, the data packet to be sent may further carry a first length value, where the first length value is used to indicate a length of data to be sent.
In an optional embodiment, according to the method shown in fig. 3, an embodiment of the present invention further provides a data transmission method. As shown in fig. 4, fig. 4 is a fourth flowchart illustrating a data transmission method according to an embodiment of the present invention. The method is applied to the receiving end and specifically comprises the following steps.
Step S401, receiving a data packet to be sent by a sending end, where the data packet to be sent is obtained by encapsulating, by the sending end, the obtained data to be sent, and the data packet to be sent carries a data identifier, where the data identifier includes timestamp information of the data to be sent and address information of the sending end.
Step S402, according to the data identification carried by each received data packet to be sent, sequencing the received data packets to be sent.
The above-described steps S401 to S402 are the same as the above-described steps S301 to S302.
Step S403, decapsulate the received data packet to be sent to obtain target data.
In the embodiment of the present invention, the manner of the above-described encapsulation and decapsulation is not particularly limited.
Step S404, according to the sorting result of each data packet to be sent by the same sending end, reading data matching the first length value carried by each data packet to be sent from the target data, and obtaining data to be sent.
In the data transmission process, due to factors such as a transmission protocol between a sending end and a receiving end, self reasons of the receiving end and the sending end, a network environment and the like, packet sticking and packet unpacking conditions may occur in data transmission. For ease of understanding, reference is made to fig. 5-a, 5-b and 5-c. Now, assume that the transmitting end 501 transmits a data packet 505 and a data packet 504 to the receiving end 502 in turn through a transmission channel 503.
Fig. 5-a is a schematic diagram of normal transmission of a data packet according to an embodiment of the present invention. In fig. 5-a, a receiver 502 can receive a packet 504 and a packet 505 normally. That is, the data packets 504 and 505 are not sticky or unpacked during the data transmission process.
Fig. 5-b is a first schematic diagram of abnormal transmission of a data packet according to an embodiment of the present invention. In fig. 5-b, the receiving end 502 does not receive the data packet 504 and the data packet 505, but receives the data packet corresponding to the data packet 504 and the data packet 505 after being pasted. That is, packet loss occurs.
Fig. 5-c is a second schematic diagram of abnormal transmission of data packets according to an embodiment of the present invention. In fig. 5-c, the receiving end 502 does not receive the data packet 504 (not shown in fig. 5-c) and the data packet 505, but receives the data packet after the data packet 505 and the data packet 5042 are pasted, and the data packet 5041. Among them, the packet 5041 and the packet 5042 are obtained by unpacking the packet 504.
For the case shown in fig. 5-a, after receiving the data packet 505 and the data packet 504, the receiving end may determine that the ordering result of the data packet 505 is higher than the ordering result of the data packet 504. The receiving end may decapsulate the data packet 505 and the data packet 504, respectively, to obtain data 1 corresponding to the data packet 505 and data 2 corresponding to the data packet 504. Since the length of the data 1 is equal to the first length value carried by the data packet 505 and the length of the data 2 is equal to the first length value carried by the data packet 504, the receiving end can determine that the data 1 and the data 2 are data to be sent by the sending end.
For the situation shown in fig. 5-b, when receiving a data packet with a sticky packet of the data packet 504 and the data packet 505, the receiving end decapsulates the data packet to obtain data 1, and at this time, the length of the data 1 is equal to the sum of the first length value corresponding to the data packet 504 and the first length value corresponding to the data packet 505. The receiving end may read the first N bytes with the length of 1 from the data 1 according to the first length value corresponding to the data packet 505, that is, the length value 1, to obtain the data 2, and read the M bytes with the length of 2 from the data 1 except the data 2 according to the first length value corresponding to the data packet 504, that is, the length value 2, to obtain the data 3, that is, the data 1 is the data remaining after removing the data 2. At this time, the receiving end may determine that the data 2 and the data 3 are to-be-sent data sent by the sending end.
For the situation shown in fig. 5-c, after receiving the data packet 505 and the data packet 5042 after being sticky and the data packet 5041, the receiving end may decapsulate the received data packet to obtain the data 1 corresponding to the data packet 505 and the data packet 5042 after being sticky and the data 2 corresponding to the data packet 5041. The receiving end can read the data 3 corresponding to the data packet 505 from the data 1 in the same manner as in fig. 5-b. Since the data 1 is the data remaining after removing the data 3, that is, the length of the data 4 is smaller than the first length value corresponding to the data packet 504, at this time, the receiving end determines the data corresponding to the data packet 504 based on the data 4 in combination with the data corresponding to the data packet received later. Since the sum of the length of data 4 and the length of data 2 is equal to the first length value corresponding to the data packet 504, the receiving end can serve data 4 and data 2 to obtain data 5. At this time, the receiving end may determine that the data 3 and the data 5 are to-be-transmitted data transmitted by the transmitting end.
In the above embodiment, the unpacking situation is not separately described, and if the data packet is only unpacked, the data to be sent may be determined in a manner corresponding to fig. 5-c. In addition, the above is only described with reference to the data packet 505 and the data packet 504, and when the transmitting end transmits a plurality of data packets to be transmitted to the receiving end, the data to be transmitted may be determined by referring to the above manner, which is not specifically described herein.
In the embodiment of the present invention, the sending end carries the first length value in the data packet sent to the receiving end, so that the receiving end can read the data in the data packet according to the first length value carried in the received data packet to obtain the data sent by the sending end to the receiving end, thereby effectively reducing the influence caused by the phenomenon of packet sticking or the phenomenon of packet unpacking in the data transmission process.
In an optional embodiment, according to the method shown in fig. 3, an embodiment of the present invention further provides a data transmission method. As shown in fig. 6, fig. 6 is a fifth flowchart of a data transmission method according to an embodiment of the present invention. The method is applied to the receiving end and specifically comprises the following steps.
Step S601, receiving a to-be-sent data packet sent by a sending end, where the to-be-sent data packet is obtained by encapsulating, by the sending end, acquired to-be-sent data, and the to-be-sent data packet carries a data identifier, where the data identifier includes timestamp information of the to-be-sent data and address information of the sending end.
Step S602, according to the data identifier carried by each received data packet to be sent, the received data packets to be sent are sorted.
The above steps S601 to S602 are the same as the above steps S301 to S302.
Step S603, receiving a heartbeat packet containing a preset character string sent by the sending end, where the heartbeat packet is sent to the receiving end by the client according to a preset time interval when the sending end and the receiving end are connected for a long time.
In this step, when the sending end is connected to the receiving end for a long time, the sending end can send a heartbeat packet containing a preset character string to the receiving end according to a preset time interval. The receiving end can receive the heartbeat packet.
Step S604, based on the heartbeat packet, determines that the long connection with the sending end is not interrupted.
In this step, when receiving the heartbeat packet, the receiving end may determine that the long connection between the receiving end and the sending end is not interrupted.
For the transmission and reception of the heartbeat packet, reference is made to the above embodiments, which are not specifically described herein.
In an optional embodiment, if the receiving end does not receive the heartbeat packet within a preset time interval or a plurality of consecutive preset time intervals, the receiving end may determine that the long connection between the receiving end and the sending end is disconnected.
By adopting the method shown in fig. 6, when the sending end and the receiving end are in long connection, the sending end maintains the heartbeat service of the sending end and the receiving end by sending the heartbeat packet containing the preset character string to the receiving end, thereby ensuring the timeliness and the accuracy of determining the long connection state between the sending end and the receiving end.
In an optional embodiment, the second length value of the preset character string is smaller than a preset length threshold.
For convenience of understanding, fig. 7 is a signaling diagram of a data transmission process according to an embodiment of the present invention.
Step S701, a transmitting end acquires data to be transmitted.
Step S702, the sending end packages the data to be sent to obtain a packaged data packet.
The data packet header of the data packet carries a first length value indicating the length of data to be sent and a data identifier, wherein the data identifier at least comprises timestamp information of the data to be sent and address information of a sending end.
Step S703, after receiving the data packet sent by the sending end, the receiving end sorts the received data packet according to the data identifier carried by the received data packet.
In step S704, the receiving end may decapsulate the received data packets to obtain target data corresponding to each data packet.
Step S705, the receiving end may read, according to the sorting result corresponding to the data packet sent by the same sending end, data matched with the first length value carried by each data packet from the target data, to obtain data to be sent.
Step S706, when the sending end is connected with the receiving end, the sending end sends a heartbeat packet containing a preset character string to the receiving end.
In step S707, after receiving the heartbeat packet, the receiving end determines that the long connection with the transmitting end is not disconnected.
Based on an inventive concept, according to the data transmission method provided by the embodiment of the invention, the embodiment of the invention also provides a data transmission device. As shown in fig. 8, fig. 8 is a schematic structural diagram of a data transmission device according to an embodiment of the present invention. The device is applied to the transmitting end and specifically comprises the following modules.
An obtaining module 801, configured to obtain data to be sent;
an encapsulation module 802, configured to encapsulate data to be sent to obtain a data packet to be sent; the data packet to be sent carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of a sending end;
a first sending module 803, configured to send a data packet to be sent to a receiving end, so that the receiving end sequences the received data packets to be sent according to a data identifier carried in each received data packet to be sent.
Optionally, the data identifier further includes attribute information and a preset value of the sending end.
Optionally, the data packet to be sent further carries a first length value, where the first length value is used to indicate a length of data to be sent.
Optionally, the data transmission device may further include:
and the second sending module is used for sending a heartbeat packet containing a preset character string to the receiving end according to a preset time interval if the sending end is in long connection with the receiving end, so that the receiving end determines that the long connection between the receiving end and the sending end is not interrupted according to the received heartbeat packet.
Optionally, the second length value of the preset character string is smaller than a preset length threshold.
Based on an inventive concept, according to the data transmission method provided by the embodiment of the invention, the embodiment of the invention also provides a data transmission device. As shown in fig. 9, fig. 9 is a schematic diagram of a second structure of a data transmission apparatus according to an embodiment of the present invention. The device is applied to a receiving end and specifically comprises the following modules.
A first receiving module 901, configured to receive a to-be-sent data packet sent by a sending end, where the to-be-sent data packet is obtained by encapsulating, by the sending end, acquired to-be-sent data, and the to-be-sent data packet carries a data identifier, where the data identifier includes timestamp information of the to-be-sent data and address information of the sending end;
a sorting module 902, configured to sort the received data packets to be sent according to the data identifier carried by each received data packet to be sent.
Optionally, the data identifier further includes attribute information and a preset value of the sending end.
Optionally, the data packet to be sent also carries a first length value, where the first length value is used to indicate the length of data to be sent;
the data transmission device may further include:
the de-encapsulation module is used for de-encapsulating the received data packet to be sent to obtain target data;
and the reading module is used for reading data matched with the first length value carried by each data packet to be sent from the target data according to the sequencing result of each data packet to be sent by the same sending end to obtain data to be sent.
Optionally, the data transmission device may further include:
the second receiving module is used for receiving a heartbeat packet which is sent by the sending end and contains a preset character string, and when the heartbeat packet is in long connection with the receiving end, the client end sends the heartbeat packet to the receiving end according to a preset time interval;
and the determining module is used for determining that the long connection with the sending end is not interrupted based on the heartbeat packet.
Optionally, the second length value of the preset character string is smaller than a preset length threshold.
By the device provided by the embodiment of the invention, the data packet sent by the sending end to the receiving end carries the data identifier, so that the receiving end can directly sequence the received data packets according to the data identifier after receiving the data packet sent by the sending end. Because the data identification carried by each data packet is composed of the timestamp information of the data to be sent and the address information of the sending end, the uniqueness of the data identification carried by each data packet is greatly improved, the repetition rate of the data identification carried by the data packet is reduced, the data sequencing accuracy of the receiving end is improved, and the data ordering is effectively maintained.
Based on an inventive concept, according to the data transmission method provided in the above embodiment of the present invention, an embodiment of the present invention further provides an electronic device, which is the above sending end. As shown in fig. 10, the system includes a processor 1001, a communication interface 1002, a memory 1003 and a communication bus 1004, wherein the processor 1001, the communication interface 1002 and the memory 1003 complete communication with each other through the communication bus 1004;
a memory 1003 for storing a computer program;
the processor 1001 is configured to implement the following steps when executing the program stored in the memory 1003:
acquiring data to be transmitted;
packaging data to be transmitted to obtain a data packet to be transmitted; the data packet to be sent carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of a sending end;
and sending the data packets to be sent to a receiving end so that the receiving end sequences the received data packets to be sent according to the data identification carried by each received data packet to be sent.
Based on an inventive concept, according to the data transmission method provided in the above embodiment of the present invention, an embodiment of the present invention further provides an electronic device, which is the above receiving end. As shown in fig. 11, the system comprises a processor 1101, a communication interface 1102, a memory 1103 and a communication bus 1104, wherein the processor 1101, the communication interface 1102 and the memory 1103 complete communication with each other through the communication bus 1104;
a memory 1103 for storing a computer program;
the processor 1101 is configured to implement the following steps when executing the program stored in the memory 1103:
receiving a data packet to be sent by a sending end, wherein the data packet to be sent is obtained by encapsulating acquired data to be sent by the sending end, and the data packet to be sent carries a data identifier which comprises timestamp information of the data to be sent and address information of the sending end;
and sequencing the received data packets to be sent according to the data identification carried by each received data packet to be sent.
Through the electronic equipment provided by the embodiment of the invention, the data packet sent by the sending end to the receiving end carries the data identifier, so that the receiving end can directly sequence the received data packet according to the data identifier after receiving the data packet sent by the sending end. Because the data identification carried by each data packet is composed of the timestamp information of the data to be sent and the address information of the sending end, the uniqueness of the data identification carried by each data packet is greatly improved, and the repetition rate of the data identification carried by the data packet is reduced, so that the accuracy of data sequencing of the receiving end is improved, and the data order is effectively maintained.
The communication bus mentioned in the electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown, but this does not mean that there is only one bus or one type of bus.
The communication interface is used for communication between the electronic equipment and other equipment.
The Memory may include a Random Access Memory (RAM) or a Non-Volatile Memory (NVM), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the processor.
The Processor may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), and the like; but also Digital Signal Processors (DSPs), application Specific Integrated Circuits (ASICs), field Programmable Gate Arrays (FPGAs) or other Programmable logic devices, discrete Gate or transistor logic devices, discrete hardware components.
Based on an inventive concept, according to the data transmission method provided in the above embodiment of the present invention, an embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and the computer program, when executed by a processor, implements the steps of any of the data transmission methods described above.
Based on an inventive concept, according to the data transmission method provided in the above embodiment of the present invention, an embodiment of the present invention further provides a computer program product containing instructions, which when run on a computer, causes the computer to execute any of the data transmission methods in the above embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the invention to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), among others.
It is noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrases "comprising one of 8230; \8230;" 8230; "does not exclude the presence of additional like elements in a process, method, article, or apparatus that comprises the element.
All the embodiments in the present specification are described in a related manner, and the same and similar parts among the embodiments may be referred to each other, and each embodiment focuses on the differences from the other embodiments. In particular, for embodiments of the apparatus, the electronic device, the computer-readable storage medium, and the computer program product, which are substantially similar to the method embodiment, the description is relatively simple, and reference may be made to part of the description of the method embodiment for relevant points.
The above description is only for the preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention shall fall within the protection scope of the present invention.

Claims (14)

1. A data transmission method is applied to a sending end, and the method comprises the following steps:
acquiring data to be transmitted;
packaging the data to be sent to obtain a data packet to be sent; the data packet to be sent carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of the sending end; the data identification further comprises attribute information and a preset numerical value of the sending end; the attribute information comprises the version number of the sending end and an ID corresponding to the service type; the data packet to be sent also carries a first length value, and the first length value is used for indicating the length of the data to be sent;
sending the data packets to be sent to a receiving end so that the receiving end sequences the received data packets to be sent according to the data identification carried by each received data packet to be sent;
the data packets to be sent are sent to a receiving end, so that the receiving end sorts the received data packets to be sent according to the data identification carried by each received data packet to be sent, and when the receiving end cannot determine a sorting result according to the timestamp information of the data to be sent, the data packets to be sent are sorted according to the priority of the address information carried by the data packets to be sent, or the data packets to be sent are sorted according to the size of the address information carried by the data packets to be sent;
and when the receiving end cannot determine a sequencing result according to the timestamp information of the data to be sent and the address information of the sending end, sequencing according to the attribute information and the preset numerical value of the sending end.
2. The method of claim 1, further comprising:
if the sending end is in long connection with the receiving end, sending a heartbeat packet containing a preset character string to the receiving end according to a preset time interval, so that the receiving end determines that the long connection between the receiving end and the sending end is not interrupted according to the received heartbeat packet.
3. The method of claim 2, wherein the second length value of the predetermined string is less than a predetermined length threshold.
4. A data transmission method, applied to a receiving end, the method comprising:
receiving a data packet to be sent by a sending end, wherein the data packet to be sent is obtained by encapsulating obtained data to be sent by the sending end, and carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of the sending end; the data identification further comprises attribute information and a preset numerical value of the sending end; the attribute information comprises the version number of the sending end and an ID corresponding to the service type; the data packet to be sent also carries a first length value, and the first length value is used for indicating the length of the data to be sent;
sequencing the received data packets to be sent according to the data identification carried by each received data packet to be sent;
decapsulating the received data packet to be sent to obtain target data;
according to the sequencing result of each data packet to be sent by the same sending end, reading data matched with a first length value carried by each data packet to be sent from the target data to obtain the data to be sent;
the sorting the received data packets to be sent according to the data identifier carried by each received data packet to be sent includes:
when the sequencing result cannot be determined according to the timestamp information of the data to be sent, sequencing according to the priority of the address information carried by the data packet to be sent, or sequencing according to the size of the address information carried by the data packet to be sent;
and when the sequencing result cannot be determined according to the timestamp information of the data to be sent and the address information of the sending end, sequencing according to the attribute information and the preset numerical value of the sending end.
5. The method of claim 4, further comprising:
receiving a heartbeat packet which is sent by the sending end and contains a preset character string, wherein when the heartbeat packet is in long connection with the receiving end, the sending end sends the heartbeat packet to the receiving end according to a preset time interval;
and determining that the long connection with the sending end is not interrupted based on the heartbeat packet.
6. The method of claim 5, wherein the second length value of the predetermined string is less than a predetermined length threshold.
7. A data transmission apparatus, applied to a transmitting end, the apparatus comprising:
the acquisition module is used for acquiring data to be transmitted;
the encapsulation module is used for encapsulating the data to be sent to obtain a data packet to be sent; the data packet to be sent carries a data identifier, and the data identifier comprises timestamp information of the data to be sent and address information of the sending end; the data identification further comprises attribute information and a preset numerical value of the sending end; the attribute information comprises the version number of the sending end and an ID corresponding to the service type; the data packet to be sent also carries a first length value, and the first length value is used for indicating the length of the data to be sent;
the first sending module is configured to send the data packets to be sent to a receiving end, so that the receiving end sorts the received data packets to be sent according to the data identifier carried by each received data packet to be sent, and when the receiving end cannot determine a sorting result according to the timestamp information of the data to be sent, sorts the data packets according to the priority of the address information carried by the data packets to be sent, or sorts the data packets according to the size of the address information carried by the data packets to be sent;
and when the receiving end cannot determine a sequencing result according to the timestamp information of the data to be sent and the address information of the sending end, sequencing according to the attribute information and the preset numerical value of the sending end.
8. The apparatus of claim 7, further comprising:
and the second sending module is used for sending a heartbeat packet containing a preset character string to the receiving end according to a preset time interval if the sending end is in long connection with the receiving end, so that the receiving end determines that the long connection with the sending end is not interrupted according to the received heartbeat packet.
9. The apparatus of claim 8, wherein the second length value of the predetermined string is less than a predetermined length threshold.
10. A data transmission apparatus, applied to a receiving end, the apparatus comprising:
a first receiving module, configured to receive a to-be-sent data packet sent by a sending end, where the to-be-sent data packet is obtained by encapsulating, by the sending end, acquired to-be-sent data, and the to-be-sent data packet carries a data identifier, where the data identifier includes timestamp information of the to-be-sent data and address information of the sending end; the data identification further comprises attribute information and a preset numerical value of the sending end; the attribute information comprises the version number of the sending end and an ID corresponding to the service type; the data packet to be sent also carries a first length value, and the first length value is used for indicating the length of the data to be sent;
the sequencing module is used for sequencing the received data packets to be sent according to the data identification carried by each received data packet to be sent;
the de-encapsulation module is used for de-encapsulating the received data packet to be sent to obtain target data;
the reading module is used for reading data matched with the first length value carried by each data packet to be sent from the target data according to the sequencing result of each data packet to be sent by the same sending end to obtain the data to be sent;
the sorting module is specifically configured to, when a sorting result cannot be determined according to the timestamp information of the data to be sent, sort according to a priority of address information carried by the data packet to be sent, or sort according to a size of the address information carried by the data packet to be sent;
and when the sequencing result cannot be determined according to the timestamp information of the data to be sent and the address information of the sending end, sequencing according to the attribute information and the preset numerical value of the sending end.
11. The apparatus of claim 10, further comprising:
the second receiving module is used for receiving a heartbeat packet which contains a preset character string and is sent by the sending end, wherein when the sending end is in long connection with the receiving end, the sending end sends the heartbeat packet to the receiving end according to a preset time interval;
and the determining module is used for determining that the long connection with the sending end is not interrupted based on the heartbeat packet.
12. The apparatus of claim 11, wherein the second length value of the predetermined string is less than a predetermined length threshold.
13. An electronic device is characterized by comprising a processor, a communication interface, a memory and a communication bus, wherein the processor and the communication interface are used for realizing mutual communication by the memory through the communication bus;
a memory for storing a computer program;
a processor for implementing the method steps of any one of claims 1 to 6 when executing a program stored in a memory.
14. A computer-readable storage medium, characterized in that a computer program is stored in the computer-readable storage medium, which computer program, when being executed by a processor, carries out the method steps of any one of the claims 1-6.
CN202010072168.9A 2020-01-21 2020-01-21 Data transmission method and device, electronic equipment and storage medium Active CN111327687B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010072168.9A CN111327687B (en) 2020-01-21 2020-01-21 Data transmission method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010072168.9A CN111327687B (en) 2020-01-21 2020-01-21 Data transmission method and device, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN111327687A CN111327687A (en) 2020-06-23
CN111327687B true CN111327687B (en) 2023-02-21

Family

ID=71171024

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010072168.9A Active CN111327687B (en) 2020-01-21 2020-01-21 Data transmission method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111327687B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113709015A (en) * 2020-05-20 2021-11-26 中兴通讯股份有限公司 Data transmission method, electronic device and storage medium
WO2022109805A1 (en) * 2020-11-24 2022-06-02 北京小米移动软件有限公司 Data transmission method and apparatus, communication device and storage medium
CN112637151B (en) * 2020-12-11 2023-05-05 深圳市英威腾电气股份有限公司 Data message transmission method, terminal device, server and storage medium
CN114253211A (en) * 2021-12-15 2022-03-29 意欧斯智能科技股份有限公司 Method for mutual verification of PLC and upper computer WCS signals
CN114025031B (en) * 2022-01-04 2022-04-08 北京航天驭星科技有限公司 Data processing method and device based on ground measurement and control system data transmission protocol
CN116700989A (en) * 2023-07-03 2023-09-05 中科驭数(北京)科技有限公司 Data transmission method, device, equipment and storage medium

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103078910A (en) * 2012-12-27 2013-05-01 华为技术有限公司 Webpage segmentation method and device
CN105450712A (en) * 2014-09-02 2016-03-30 阿里巴巴集团控股有限公司 Data transmission method and device
CN105553832A (en) * 2015-12-25 2016-05-04 北京奇虎科技有限公司 Message sending and receiving method and device
WO2016201643A1 (en) * 2015-06-17 2016-12-22 华为技术有限公司 Data transmission method and apparatus for internet of vehicles
CN109032534A (en) * 2018-08-30 2018-12-18 百度在线网络技术(北京)有限公司 A kind of method for message transmission, device, equipment and medium
CN109981475A (en) * 2019-03-27 2019-07-05 无锡海斯凯尔医学技术有限公司 Data transmission, reception, transmission method, equipment, system and readable storage medium storing program for executing
CN110311855A (en) * 2019-06-25 2019-10-08 广州虎牙科技有限公司 User message processing method, device, electronic equipment and storage medium

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109639811B (en) * 2018-12-21 2022-01-25 北京金山云网络技术有限公司 Data transmission method, data storage method, device, server and storage medium

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103078910A (en) * 2012-12-27 2013-05-01 华为技术有限公司 Webpage segmentation method and device
CN105450712A (en) * 2014-09-02 2016-03-30 阿里巴巴集团控股有限公司 Data transmission method and device
WO2016201643A1 (en) * 2015-06-17 2016-12-22 华为技术有限公司 Data transmission method and apparatus for internet of vehicles
CN105553832A (en) * 2015-12-25 2016-05-04 北京奇虎科技有限公司 Message sending and receiving method and device
CN109032534A (en) * 2018-08-30 2018-12-18 百度在线网络技术(北京)有限公司 A kind of method for message transmission, device, equipment and medium
CN109981475A (en) * 2019-03-27 2019-07-05 无锡海斯凯尔医学技术有限公司 Data transmission, reception, transmission method, equipment, system and readable storage medium storing program for executing
CN110311855A (en) * 2019-06-25 2019-10-08 广州虎牙科技有限公司 User message processing method, device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN111327687A (en) 2020-06-23

Similar Documents

Publication Publication Date Title
CN111327687B (en) Data transmission method and device, electronic equipment and storage medium
CN108965484B (en) Internet of things data transmission method, system and terminal
US10528410B2 (en) Apparatus, method and system to exchange error information in a unified protocol communication
US20210160353A1 (en) Data sending method and device, data receiving method and device, and system
CN112039796B (en) Data packet transmission method and device, storage medium and electronic equipment
CN113287329B (en) Data transmission method and device
WO2018171641A1 (en) Method and device for transmitting and receiving network management information, transmitting apparatus and receiving apparatus
CN110022259B (en) Message arrival rate determining method and device, data statistics server and storage medium
US20220358070A1 (en) Pcie-based data transmission method and apparatus
CN110213756A (en) A kind of data transmission method, device and its relevant device
WO2018133172A1 (en) Data transmission method and device, transmitting terminal, receiving terminal, and system
US9485114B2 (en) MAC abstraction sub-layer and MAC table for a communication system and related communication device
CN109286564B (en) Message forwarding method and device
CN104348728A (en) Method and equipment for generating forwarding information
US20120005399A1 (en) Data transmission system and method of reading data
CN112422485B (en) Communication method and device of transmission control protocol
CN111786859A (en) Packet loss detection method, device and storage medium
CN115442177B (en) Data communication method and device of CAN (controller area network)
CN111464422A (en) Interaction method, interaction device, electronic equipment and storage medium
CN106789440B (en) IP packet header detection method and device
CN113196720A (en) Data processing method, transmission equipment and data processing system
US20240137954A1 (en) Sending method, receiving method for bluetooth broadcasting, and device
US20220365895A1 (en) Pcie-based data transmission method and apparatus
CN115242733B (en) Message multicast method, multicast gateway, electronic device and storage medium
CN116226027B (en) Data transmission system, method, device, communication equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20210527

Address after: 25, 5th floor, shuangjingfang office building, 3 frisha street, Singapore

Applicant after: Zhuomi Private Ltd.

Address before: Room 1101, Santai Commercial Building, 139 Connaught Road, Hong Kong, China

Applicant before: HONG KONG LIVE.ME Corp.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant