Data transmission method and device, storage medium and electronic device

By establishing a communication connection link between the receiving end and the sending end, and determining the data reception situation based on the connection status, the problem of low data transmission efficiency in the prior art is solved, and efficient and reliable data transmission is achieved.

CN112860617BActive Publication Date: 2025-03-14ZHEJIANG DAHUA TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110144496.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-02-02
Publication Date
2025-03-14
Estimated Expiration
2041-02-02

AI Technical Summary

Technical Problem

In the prior art, the transmission of data connecting both ends requires an intermediary system, resulting in low data transmission efficiency.

Method used

The communication connection Link is established by the receiving end and the sending end, and the data reception situation is determined based on the current status of the connection link, so as to realize data transmission without the need for an additional intermediary system.

Benefits of technology

This method allows independent scheduling between the two ends of the connection, supports multi-threaded context concurrent data communication, has reliable and asynchronous characteristics, and improves data transmission efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112860617B_ABST
    Figure CN112860617B_ABST
Patent Text Reader

Abstract

The present invention discloses a data transmission method and device, a storage medium and an electronic device. The method comprises: using a receiving end to receive a data transmission instruction sent by a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; according to the current state of the connection Link, determining whether the receiving end receives data, the two ends of the connection are established, no additional intermediary system is required, the two ends of the connection can be scheduled independently, each end supports multi-threaded context, concurrent data communication, has reliable characteristics and asynchronous characteristics, and thus solves the technical problem in the prior art that the transmission of data at the two ends of the connection requires an intermediary system, resulting in low data transmission efficiency.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technology, and in particular to a data transmission method and device, a storage medium and an electronic device. Background Art

[0002] In a multi-processor system, data transmission between processors is usually achieved through various buses and point-to-point transmission methods. Based on the bus transmission architecture, since multiple processors share the bus, bus arbitration is required between the processors. Bus arbitration is not conducive to real-time processing application scenarios, because after the application submits the bus application, it needs to wait for the authorization of the bus arbitration mechanism before occupying the bus for data transmission, and the waiting time is unpredictable for the application.

[0003] Unlike bus transmission, the timing of transmission initiation in point-to-point transmission is completely controlled by the application. Therefore, the transmission time is completely predictable, so that the application can have a reasonable budget for the time between data exchange and data processing, which meets the application requirements of real-time processing. Point-to-point transmission has been applied in the field of real-time processing. However, point-to-point transmission requires the corresponding setting of relevant transmission mode and transmission length parameters at the sending and receiving ends, and requires the sending and receiving ends to make the same settings. This setting is pre-agreed and cannot be changed in real time.

[0004] In the prior art, data transmission usually relies on the characteristics of the TCP transmission protocol. The effects of these characteristics are only effective in the protocol stack of point-to-point connections, and the effects cannot be extended to the application logic based on the protocol stack. For example, a reply message to a command can only confirm that the TCP protocol stack on the other end has received it, but cannot confirm that the application logic on the other end has received the reply message.

[0005] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention

[0006] The embodiments of the present invention provide a data transmission method and device, a storage medium and an electronic device, so as to at least solve the technical problem in the prior art that the transmission of data between two ends requires an intermediary system, resulting in low data transmission efficiency.

[0007] According to one aspect of an embodiment of the present invention, a data transmission method is provided, including: a receiving end receives a data transmission instruction sent by a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; based on the current state of the connection Link, determining whether the receiving end receives the data.

[0008] Optionally, determining whether the receiving end receives the data based on the current state of the connection Link includes: when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end; when the current state of the connection Link is a non-idle state, the data sent by the sending end is placed in a queue.

[0009] Optionally, when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, including: setting the current state of the connection Link to a locked state, and the sending end sends the data in the transmission protocol buffer.

[0010] Optionally, when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, including: setting the current state of the connection Link to a locked state, and the sending end wakes up and sends the waiting data.

[0011] Optionally, the sending end wakes up and sends the waiting data, including: when the waiting data is located in the transmission protocol buffer, or the waiting time of the waiting data is greater than a first predetermined time, the sending end wakes up and sends the waiting data.

[0012] Optionally, the sending end wakes up and sends the waiting data, including: when the waiting time of the waiting data is greater than a second time, switching the connection Link to a cache waiting mode until being woken up.

[0013] Optionally, when the current state of the connection Link is idle, the receiving end receives the data sent by the sending end, including: in the process of the receiving end receiving the data sent by the sending end, the connection Link is allowed to be preempted and switched to receive suspension, waiting to be awakened again, directly fetching information from the suspension cache queue, or entering the receive waiting state again.

[0014] Optionally, when the current state of the connection Link is idle, after the receiving end receives the data sent by the sending end, the method includes: the receiving end sends a response message to the sending end, wherein the response information is used to indicate that the data has been received; wherein, when the connection Link is in a non-idle state, the response information is queued and sent when it is idle.

[0015] According to another aspect of an embodiment of the present invention, a data transmission method is also provided, including: a sending end sends a data transmission instruction to a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to send data; based on the current state of the connection Link, determining whether the sending end sends the data.

[0016] According to another aspect of an embodiment of the present invention, a data transmission device is also provided, including: a receiving unit, used for a receiving end to receive a data transmission instruction sent by a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; a determination unit, used to determine whether the receiving end receives the data according to the current state of the connection Link.

[0017] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the above-mentioned data transmission method when running.

[0018] According to another aspect of an embodiment of the present invention, there is provided an electronic device, including a memory and a processor, wherein the memory stores a computer program, and the processor is configured to execute the data transmission method through the computer program.

[0019] In an embodiment of the present invention, a receiving end receives a data transmission instruction sent by a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; a method of determining whether the receiving end receives data is used according to the current state of the connection Link, thereby achieving the establishment of both ends of the connection without the need for an additional intermediary system. Both ends of the connection can be scheduled independently, and each end supports multi-threaded contexts and concurrent data communication, with reliable and asynchronous characteristics, thereby solving the technical problem in the prior art that the transmission of data at both ends of the connection requires an intermediary system, resulting in low data transmission efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0021] Figure 1 is a schematic diagram of an application environment of an optional data transmission method according to an embodiment of the present invention;

[0022] Figure 2 is a flow chart of an optional data transmission method according to an embodiment of the present invention (I);

[0023] Figure 3 is a flow chart (II) of an optional data transmission method according to an embodiment of the present invention;

[0024] Figure 4 This is a flow chart of an optional command-event hybrid communication method according to an embodiment of the present invention (I);

[0025] Figure 5 This is a flow chart of an optional method of command-event hybrid communication according to an embodiment of the present invention (II);

[0026] Figure 6 is a flow chart (III) of an optional method of command-event hybrid communication according to an embodiment of the present invention;

[0027] Figure 7 is a schematic structural diagram of an optional data transmission device (I) according to an embodiment of the present invention;

[0028] Figure 8 is a schematic structural diagram of an optional data transmission device (II) according to an embodiment of the present invention;

[0029] Fig. 9 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. DETAILED DESCRIPTION

[0030] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.

[0031] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0032] According to one aspect of an embodiment of the present invention, a data transmission method is provided. Optionally, as an optional implementation, the data transmission method may be, but is not limited to, applied to: Figure 1 In the environment shown, there are terminal 102, network 110 and terminal 104.

[0033] The receiving end in the terminal 102 receives the data transmission instruction sent by the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; according to the current state of the connection Link, the method of determining whether the receiving end receives the data reaches the two ends of the connection, without the need for an additional intermediary system, the two ends of the connection can be scheduled independently, each end supports multi-threaded context, and concurrent data communication is carried out, with reliable and asynchronous characteristics, without the need for additional protocol stack context, thereby solving the technical problem in the prior art that the transmission of data at the two ends of the connection requires an intermediary system, resulting in low data transmission efficiency.

[0034] Optionally, in this embodiment, the above-mentioned terminal can be a terminal device configured with a target client, which can include but is not limited to at least one of the following: a mobile phone (such as an Android phone, an iOS phone, etc.), a laptop, a tablet computer, a PDA, a MID (Mobile Internet Devices), a PAD, a desktop computer, a smart TV, etc. The target client can be a video client, an instant messaging client, a browser client, an education client, etc. The above-mentioned network can include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that realize wireless communication. The above-mentioned server can be a single server, or it can be a server cluster composed of multiple servers, or it can be a cloud server. The above is only an example, and there is no limitation on this in this embodiment.

[0035] Optionally, as an optional implementation, as Figure 2 As shown, the above data transmission method includes:

[0036] Step S202: The receiving end receives the data transmission instruction sent by the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data.

[0037] Step S204: Determine whether the receiving end receives data according to the current state of the connection Link.

[0038] Optionally, the above-mentioned data transmission method may include but is not limited to mixed communication of data, commands, and events in point-to-point, reliable, synchronous or asynchronous modes, wherein the above-mentioned data may include but is not limited to commands and events, the above-mentioned sending end may be a terminal, and the receiving end may be a terminal, and is applied to the data transmission process in multiple processors.

[0039] Optionally, in this embodiment, determining whether the receiving end receives data based on the current state of the connection Link may include: when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end; when the current state of the connection Link is a non-idle state, the data sent by the sending end is placed in a queue.

[0040] Wherein, when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, which may include: setting the current state of the connection Link to a locked state, and the sending end sends the data in the transmission protocol buffer.

[0041] Optionally, in this embodiment, when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, which may include: setting the current state of the connection Link to a locked state, and the sending end wakes up and sends the waiting data.

[0042] The sending end waking up and sending the waiting data may include: when the waiting data is in the transmission protocol buffer or the waiting time of the waiting data is greater than a first predetermined time, the sending end waking up and sending the waiting data.

[0043] It should be noted that the sending end waking up and sending the waiting data may include: when the waiting time of the waiting data is greater than the second time, switching the connection Link to a cache waiting mode until being awakened.

[0044] Optionally, in this embodiment, when the current state of the connection Link is idle, the receiving end receives the data sent by the sending end, which may include: in the process of the receiving end receiving the data sent by the sending end, the connection Link is allowed to be preempted and switched to receive suspension, waiting to be awakened again, directly fetching information from the suspension cache queue, or entering the receive waiting state again.

[0045] Among them, when the current state of the connection Link is idle, after the receiving end receives the data sent by the sending end, it can include: the receiving end sends a response message to the sending end, wherein the response information is used to indicate that the data reception has been completed; wherein, when the connection Link is in a non-idle state, the response information is queued and sent when it is idle.

[0046] Through the example provided by the present application, a receiving end receives a data transmission instruction sent by a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; according to the current state of the connection Link, a method of determining whether the receiving end receives data is achieved, thereby achieving the establishment of both ends of the connection without the need for an additional intermediary system. Both ends of the connection can be scheduled independently, and each end supports multi-threaded contexts for concurrent data communication, with reliable and asynchronous characteristics, without the need for additional protocol stack contexts, thereby solving the technical problem in the prior art that the transmission of data at both ends of the connection requires an intermediary system, resulting in low data transmission efficiency.

[0047] Optionally, as an optional implementation, as Figure 3 The above data transmission method includes:

[0048] Step S302, the sending end sends a data transmission instruction to the receiving end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to send data.

[0049] Step S304: Determine whether the sender sends data according to the current state of the connection Link.

[0050] Through the embodiments provided by the present application, a sending end sends a data transmission instruction to a sending end through an interface, wherein a receiving end and a sending end establish a communication connection Link, and the data transmission instruction is used to send data; a method of determining whether the receiving end receives data is used according to the current state of the connection Link, thereby achieving the establishment of both ends of the connection without the need for an additional intermediary system. Both ends of the connection can be scheduled independently, and each end supports multi-threaded contexts for concurrent data communication, has reliable and asynchronous characteristics, and does not require an additional protocol stack context, thereby solving the technical problem in the prior art that the transmission of data at both ends of the connection requires an intermediary system, resulting in low data transmission efficiency.

[0051] Optionally, the present application also provides an optional embodiment of a data-command-event hybrid communication method. Figure 4 As shown, a flow chart of a method for data-command-event hybrid communication (I) is shown, and the specific details are as follows.

[0052] 0) At a certain moment of a certain Link, T2 or T3 calls the interface SendData, SendCommand or PostEvent to send data, send or post a command or event with ID = X, and data Data = […]. At this time, T1 may have called the RecvData, RecvCommand or WaitEvent interface.

[0053] 1) If the current Link is in "Idle", jump to step 2; if it is in "AckRecving or CmdExecuting" of "Busy Cause", jump to step 6. This type of busy cause is "short type", which means it will be processed quickly; if it is in "DataRecving, CmdRecving or EventWaiting" of "Busy Cause", jump to step 7. This type of busy cause is "long type", which means it is likely to take a long time to receive new information.

[0054] 2) Lock the transmission channel of the Link and execute the sending data, command or delivery event. If the execution fails, typically due to reasons such as disconnection and full sending queue, jump to step 4.

[0055] 3) If successful and ACK is not required (correct command response), jump to step 4 immediately. Otherwise, wait for the ACK of the received command on this link. If the received content does not match, place it in the receive buffer and continue to wait for ACK. If it matches or times out, jump to step 4.

[0056] 4) Unlock the transmission channel of the Link. If the current Link is waiting to send, wake it up to continue sending. Otherwise, check whether the current Link is waiting to receive. If so, wake it up to continue receiving, including processing with receiving buffer.

[0057] 5) End: The SendCommand interface is called on the Link and returns. It may succeed or fail. The reason for the failure may be timeout or other reasons such as link disconnection.

[0058] 6) First, determine whether there is an idle CPU core in Tn of AckRecving. If so, it is worth "busy waiting", or whether Tn of CmdExecuing is running on other CPU cores, that is, whether Tn has other independent CPUs to run during busy waiting. If it is determined to be worth "busy waiting", spin lock waiting is adopted, and the link can be unlocked quickly, thereby reducing task switching. If a signal that the link has been unlocked is received during busy waiting, jump to step 1; if the busy waiting times out, enter "sleep waiting", that is, sleep waiting for the unlock signal to wake up or timeout wake up, and jump to step 1 or step 5 respectively;

[0059] 7) The sub-process switches Link to receive buffer mode, unlocks Link and jumps to step 1.

[0060] like Figure 5 As shown, a method flow chart of data-command-event hybrid communication (II) is described in detail as follows:

[0061] 0) Start: At a certain moment in a certain Link, Tn calls the interface RecvData, RecvCommand or WaitEvent to receive or wait for the data, command or event arriving at this Link.

[0062] 1) If the current Link is in the "Idle" state, jump to step 3.

[0063] 2) First, lock the transmission channel of the Link and start to perform the receiving or waiting operation. If there is already incoming information in the transmission protocol buffer at this time, directly obtain the information in it and go to step 3; otherwise, enter the waiting mode until being awakened, and determine the awakening reason. If there is incoming information, obtain the information, or the awakening reason is timeout. Both of these awakening reasons go to step 3; if the awakening reason is preemption, switch the Link to cache waiting mode until being awakened.

[0064] 3) Unlock the transmission channel of the Link. If there is a task waiting to be sent, wake up the sub-process: Link_Send / Post.

[0065] 4) Same as step 6 of Link_Send / Post.

[0066] 5) The Link already has cached information, and directly obtains these cached commands or events.

[0067] 6) End the receiving or event process of this Link.

[0068] like Figure 6 As shown, a flow chart of a method for data-command-event hybrid communication (II) is described in detail as follows.

[0069] 0) Start: At a certain moment in a certain Link, Tn calls the interface AckCommand or CompleteEvent to confirm or complete the commands that have been executed or the events that have been processed in this Link.

[0070] 1) If it is idle, go directly to step 2; if it is not idle, go directly to step 3.

[0071] 2) Execution: First transmit the Ack or Complete information queued in the queue, and then transmit this Ack or Complete information.

[0072] 3) Queuing: Put the information to be Ack or Complete into the queue and start it when it is free.

[0073] 4) Receive: Complete the transmission of Ack or Complete.

[0074] In this embodiment, (1) when the "busy reason" of the transmission channel is "short type", a spin-type busy wait or task sleep wait is performed, or the link is switched to receive suspension, so that the current task tries to obtain the transmission right of the channel again. The spin-type busy wait first determines whether the current task and the task being waited are running on different CPUs at the same time. Only if concurrent running is satisfied will it be busy wait, otherwise it will directly sleep wait. (2) When the "busy reason" of the transmission channel is "long type", it switches to suspension mode and waits to be awakened. (3) When the current task receives information beyond the expectations of this context, it will assign it to and wake up the receive suspended task. (4) When the task is in the receive state, it can be preempted and switched to receive suspension, waiting to be awakened again, directly taking information from the suspension cache queue, or entering the receive wait state again. (5) When the task confirms and completes the information transmission, if the transmission channel is "busy", it will be directly queued and sent when it is idle.

[0075] Through the embodiments provided in the present application, the above-mentioned data-command-event hybrid communication method has the characteristics of supporting both traditional data sending and receiving, reliable synchronous command execution, and reliable asynchronous event processing. It only requires the context of calling the interface, and does not require the protocol stack context.

[0076] It should be noted that, for the above-mentioned method embodiments, for the sake of simplicity, they are all described as a series of action combinations, but those skilled in the art should know that the present invention is not limited by the described action sequence, because according to the present invention, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present invention.

[0077] According to another aspect of the embodiments of the present invention, a data transmission device for implementing the above data transmission method is also provided. Figure 7 As shown, the data transmission device comprises:

[0078] The receiving unit 71 is used for the receiving end to receive the data transmission instruction sent by the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data.

[0079] The determination unit 73 is used to determine whether the receiving end receives data according to the current state of the connection Link.

[0080] Through the embodiment provided by the present application, a receiving unit 71 is used to receive a data transmission instruction sent by a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; the determining unit 73 determines whether the receiving end receives data according to the current state of the connection Link. The two ends of the connection are established without the need for an additional intermediary system, and the two ends of the connection can be scheduled independently. Each end supports multi-threaded contexts, and concurrent data communication is performed, with reliable and asynchronous characteristics, without the need for additional protocol stack contexts, thereby solving the technical problem in the prior art that the transmission of data at both ends of the connection requires an intermediary system, resulting in low data transmission efficiency.

[0081] Optionally, the above-mentioned determination unit 73 may include: a receiving module, which is used for the receiving end to receive data sent by the sending end when the current state of the connection Link is an idle state; and a storage module, which is used for putting the data sent by the sending end into a queue when the current state of the connection Link is a non-idle state.

[0082] The above-mentioned receiving module may include: a first receiving submodule, which is used to set the current state of the connection Link to a locked state, and the sending end sends the data in the transmission protocol buffer.

[0083] The above-mentioned receiving module may include: a second receiving submodule, which is used to set the current state of the connection Link to a locked state, and the sending end wakes up and sends the waiting data.

[0084] It should be noted that the second receiving submodule is also used for waking up the sending end and sending the waiting data when the waiting data is in the transmission protocol buffer or the waiting time of the waiting data is longer than the first predetermined time.

[0085] The second receiving submodule is further configured to switch the connection Link to a cache waiting mode until being awakened when the waiting time of the waiting data is longer than a second time.

[0086] The above-mentioned receiving unit 71 may include: a processing module, which is used to allow the connection Link to be preempted and switched to receiving suspension during the process of receiving data sent by the sending end at the receiving end, waiting to be awakened again, directly taking information from the suspension cache queue, or entering the receiving waiting state again.

[0087] The above-mentioned device may also include: a sending unit, which is used to send a response message to the sending end after the receiving end receives the data sent by the sending end when the current state of the connection Link is an idle state, wherein the response information is used to indicate that the data reception has been completed; wherein, when the connection Link is in a non-idle state, the response information is queued and sent when it is idle.

[0088] According to another aspect of the embodiment of the present invention, a data transmission device (II) for implementing the above data transmission method is also provided. Figure 8 As shown, the data transmission device includes:

[0089] The sending unit 81 is used for the sending end to send a data transmission instruction to the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to send data.

[0090] The determination unit 83 is used to determine whether the sender sends data according to the current state of the connection Link.

[0091] Through the example provided by this application, the sending unit 81 sends a data transmission instruction to the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to send data; the determination unit 83 determines whether to send data to the receiving end according to the current state of the connection Link. The two ends of the connection are established without the need for an additional intermediary system. The two ends of the connection can be scheduled independently, and each end supports multi-threaded contexts for concurrent data communication. It has reliable and asynchronous characteristics, and does not require additional protocol stack contexts. This solves the technical problem in the prior art that the transmission of data at both ends of the connection requires an intermediary system, resulting in low data transmission efficiency.

[0092] According to another aspect of the embodiments of the present invention, there is also provided an electronic device for implementing the above data transmission method. The electronic device may be Figure 1 The terminal device or server shown in the figure. This embodiment is described by taking the electronic device as a server as an example. Fig. 9 As shown, the electronic device includes a memory 902 and a processor 904. The memory 902 stores a computer program, and the processor 904 is configured to execute the steps in any of the above method embodiments through the computer program.

[0093] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.

[0094] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:

[0095] S1, the receiving end receives the data transmission instruction sent by the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data;

[0096] S2: Determine whether the receiving end receives data based on the current state of the connection Link.

[0097] Alternatively, a person skilled in the art may understand that: Fig. 9 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (MID), a PAD, and other terminal devices. Fig. 9 The electronic device and the electronic equipment described above are not limited in structure. Fig. 9 More or fewer components (such as network interfaces, etc.) as shown in, or with Fig. 9 Different configurations are shown.

[0098] Among them, the memory 902 can be used to store software programs and modules, such as program instructions / modules corresponding to the data transmission method and device in the embodiment of the present invention. The processor 904 executes various functional applications and data processing by running the software programs and modules stored in the memory 902, that is, to realize the above-mentioned data transmission method. The memory 902 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 902 may further include a memory remotely located relative to the processor 904, and these remote memories may be connected to the terminal via a network. Examples of the above-mentioned networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 902 can be specifically used, but not limited to, to store connection link status information, transmission data and other information. As an example, such as Fig. 9 As shown, the memory 902 may include, but is not limited to, the receiving unit 71 and the determining unit 73 in the data transmission device. In addition, it may also include, but is not limited to, other module units in the data transmission device, which will not be described in detail in this example.

[0099] Optionally, the transmission device 906 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wired network and a wireless network. In one example, the transmission device 906 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 906 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0100] In other embodiments, the terminal device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, the nodes may form a peer-to-peer (P2P, Peer To Peer) network, and any form of computing device, such as a server, terminal and other electronic devices, may become a node in the blockchain system by joining the peer-to-peer network.

[0101] According to another aspect of the embodiments of the present invention, a computer-readable storage medium is provided, in which a computer program is stored, wherein the computer program is configured to execute the steps of any of the above method embodiments when run.

[0102] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:

[0103] S1, the receiving end receives the data transmission instruction sent by the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data;

[0104] S2: Determine whether the receiving end receives data based on the current state of the connection Link.

[0105] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the terminal device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a disk or an optical disk, etc.

[0106] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.

[0107] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to perform all or part of the steps of the methods described in various embodiments of the present invention.

[0108] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.

[0109] In the several embodiments provided in the present application, it should be understood that the disclosed client can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0110] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0111] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0112] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.

Claims

1. A data transmission method, characterized in that: include: The receiving end receives the data transmission instruction sent by the sending end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; Determine whether the receiving end receives the data according to the current state of the connection Link; Determining whether the receiving end receives the data according to the current state of the connection Link includes: when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end; when the current state of the connection Link is a non-idle state, the data sent by the sending end is queued; When the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, including: in the process of the receiving end receiving the data sent by the sending end, the connection Link is allowed to be preempted and switched to a receiving suspension state, waiting to be awakened again, directly taking information from a suspension cache queue, or entering a receiving waiting state again; When the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, including: setting the current state of the connection Link to a locked state, and the sending end wakes up and sends the waiting data; The sending end wakes up and sends the waiting data, including: when the waiting data is located in the transmission protocol buffer, or the waiting time of the waiting data is greater than the first predetermined time, the sending end wakes up and sends the waiting data; the sending end wakes up and sends the waiting data, including: when the waiting time of the waiting data is greater than the second time, the connection Link is switched to the cache waiting mode until it is woken up.

2. The method according to claim 1, characterized in that When the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, including: The current state of the connection Link is set to a locked state, and the sending end sends the data in the transmission protocol buffer.

3. The method according to claim 1, characterized in that: When the current state of the connection Link is an idle state, after the receiving end receives the data sent by the sending end, the method includes: The receiving end sends a response message to the sending end, wherein the response information is used to indicate that the data has been received; Wherein, when the connection Link is in a non-idle state, the response information is queued and sent when it is idle.

4. A data transmission method, characterized in that: include: The sending end sends a data transmission instruction to the receiving end through the interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to send data; Determine whether the sending end sends the data according to the current state of the connection Link; Determining whether the sending end sends the data according to the current state of the connection Link includes: when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end; when the current state of the connection Link is a non-idle state, the data sent by the sending end is queued; When the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, including: in the process of the receiving end receiving the data sent by the sending end, the connection Link is allowed to be preempted and switched to a receiving suspension state, waiting to be awakened again, directly taking information from a suspension cache queue, or entering a receiving waiting state again; When the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end, including: setting the current state of the connection Link to a locked state, and the sending end wakes up and sends the waiting data; The sending end wakes up and sends the waiting data, including: when the waiting data is located in the transmission protocol buffer, or the waiting time of the waiting data is greater than the first predetermined time, the sending end wakes up and sends the waiting data; the sending end wakes up and sends the waiting data, including: when the waiting time of the waiting data is greater than the second time, the connection Link is switched to the cache waiting mode until it is woken up.

5. A data transmission device, characterized in that: include: A receiving unit, configured for receiving a data transmission instruction sent by a sending end through an interface, wherein the receiving end and the sending end establish a communication connection Link, and the data transmission instruction is used to transmit data; A determination unit, configured to determine whether the receiving end receives the data according to a current state of the connection Link; The device is used to determine whether the sender sends the data according to the current state of the connection Link in the following manner: when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sender; when the current state of the connection Link is a non-idle state, the data sent by the sender is placed in a queue; The device is used for, when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end in the following manner: during the process of the receiving end receiving the data sent by the sending end, the connection Link is allowed to be preempted and switched to a receiving suspension state, waiting to be awakened again, directly fetching information from a suspension cache queue, or entering a receiving waiting state again; The device is used for, when the current state of the connection Link is an idle state, the receiving end receives the data sent by the sending end in the following manner: setting the current state of the connection Link to a locked state, the sending end wakes up and sends the waiting data; The device is used to wake up the sending end and send the waiting data in the following manner: when the waiting data is in the transmission protocol buffer, or the waiting time of the waiting data is greater than the first predetermined time, the device is used to wake up the sending end and send the waiting data in the following manner; the sending end wakes up and sends the waiting data: when the waiting time of the waiting data is greater than the second time, the connection Link is switched to the cache waiting mode until it is awakened.

6. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 4 when executed.

7. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 4 through the computer program.

Citation Information

Patent Citations

  • Control method and device of Bluetooth connection, and control equipment and storage medium

    CN107911871A

  • Data sending method and device, storage medium and electronic device

    CN110445580A