CN116488778A - Data communication method and device and terminal equipment - Google Patents

Data communication method and device and terminal equipment Download PDF

Info

Publication number
CN116488778A
CN116488778A CN202211442561.8A CN202211442561A CN116488778A CN 116488778 A CN116488778 A CN 116488778A CN 202211442561 A CN202211442561 A CN 202211442561A CN 116488778 A CN116488778 A CN 116488778A
Authority
CN
China
Prior art keywords
data frame
response
sent
communication state
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211442561.8A
Other languages
Chinese (zh)
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.)
Ningbo Space Engine Technology Co ltd
Original Assignee
Ningbo Space Engine Technology Co 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 Ningbo Space Engine Technology Co ltd filed Critical Ningbo Space Engine Technology Co ltd
Priority to CN202211442561.8A priority Critical patent/CN116488778A/en
Publication of CN116488778A publication Critical patent/CN116488778A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/18Automatic repetition systems, e.g. Van Duuren systems
    • H04L1/1867Arrangements specially adapted for the transmitter end
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/1607Details of the supervisory signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L47/00Traffic control in data switching networks
    • H04L47/50Queue scheduling
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The invention is applicable to the technical field of network communication, and provides a data communication method, a data communication device and terminal equipment, wherein the data communication method comprises the following steps: when a data frame to be sent exists in the message queue, the current communication state of the information source equipment is obtained; if the current communication state is in a normal communication state, the data frame to be sent is sent to information sink equipment; and if the data frame to be sent is a non-response data frame, changing the current communication state into a waiting response state. According to the scheme, connection-oriented is not needed, and whether the data frame to be transmitted is transmitted or not is determined only according to the current communication state. And changing the current communication state according to the data frame type. And after the non-response data frame is sent, the data frame to be sent is sent again when the first response data frame returned by the information sink equipment is not received, so that the situations of abnormal data transmission, error code or frame loss and the like are avoided.

Description

Data communication method and device and terminal equipment
Technical Field
The present invention belongs to the technical field of network communications, and in particular, relates to a data communication method, device and terminal equipment.
Background
The TCP (Transmission Control Protocol) and UDP (User Datagram Protocol) protocols belong to the transport layer protocols. Where TCP communication provides reliable transmission of data in an IP environment, services that it provides include data streaming, reliability, effective flow control, full duplex operation, and multiplexing. TCP communication is connection-oriented, and requires three handshakes to be performed before data is sent to establish network connection, so that the processing procedure is complicated and the processor overhead is occupied.
These disadvantages of TCP based communication can be solved by using UDP communication, which is a connectionless-oriented communication mode, requiring less processor overhead. However, since UDP communication is connectionless, data transmission anomalies, errors, frame loss, and the like are likely to occur. How to solve the above-mentioned drawbacks of the UDP communication method is a technical problem to be solved.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a data communication method, apparatus, terminal device, and computer readable storage medium, so as to solve the technical problem that since UDP communication is connectionless, data transmission anomalies, bit errors, or frame loss occur easily.
A first aspect of an embodiment of the present invention provides a data communication method, where the data communication method is applied to a source device, and the data communication method includes:
When a data frame to be sent exists in the message queue, the current communication state of the information source equipment is obtained;
if the current communication state is in a normal communication state, the data frame to be sent is sent to information sink equipment;
if the data frame to be sent is a non-response data frame, changing the current communication state into a waiting response state; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device.
Further, after the step of obtaining the current communication state of the source device when the data frame to be transmitted exists in the message queue, the method further includes:
if the current communication state is in a waiting response state, obtaining the retransmission times and the retransmission duration;
and if the retransmission times are smaller than a first threshold value and the retransmission time period is longer than a second threshold value, the data frame to be transmitted is retransmitted to the information sink equipment.
Further, after the step of acquiring the retransmission times and the retransmission duration if the current communication state is in the waiting response state, the method further includes:
And if the retransmission times are not less than the first threshold value and the retransmission time is longer than the second threshold value, discarding the data frame to be transmitted in the message queue and changing the current communication state into a normal communication state.
Further, after the step of transmitting the data frame to be transmitted if the current communication state is in the normal communication state, the method further includes:
and if the data frame to be sent is the second response data frame, changing the current communication state to the normal communication state, and setting a retransmission counter to 0.
Further, after the step of changing the current communication state to the waiting response state if the data frame to be sent is the non-response data frame, the method further includes:
adding 1 to the retransmission counter and recording the current frame number of the data frame to be transmitted; the current frame sequence number is used for accumulating on the basis of the current frame sequence number when the data frame is transmitted subsequently.
A second aspect of an embodiment of the present invention provides a data communication method, which is applied to a sink device, the data communication method including:
receiving a data frame to be transmitted, which is transmitted by the source equipment in a normal communication state;
If the data frame to be sent is determined to be a non-response data frame, a first response data frame is sent to the information source equipment;
when the data frame to be sent is a non-response data frame, the communication state of the information source equipment is a waiting response state; the first response data frame is used for determining that the data frame to be sent is received to the information source equipment, and indicating the information source equipment to change the waiting response state into the normal communication state.
Further, after the step of receiving the data frame to be transmitted, which is sent by the source device in the normal communication state, the method further includes:
if the data frame to be sent is determined to be a second response data frame, a response result in the response data frame is obtained;
if the response result is correct, acquiring a first frame sequence number of the response data frame;
and if the first frame sequence number is correct and is continuous with the second sequence number of the last data frame, changing the current communication state into the normal communication state.
A third aspect of an embodiment of the present invention provides a data communication apparatus, including:
an obtaining unit, configured to obtain a current communication state of the source device when a data frame to be sent exists in a message queue;
A transmitting unit, configured to transmit the data frame to be transmitted to a sink device if the current communication state is in a normal communication state;
a changing unit, configured to change the current communication state to a waiting response state if the data frame to be sent is a non-response data frame; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device.
A fourth aspect of an embodiment of the present invention provides a data communication apparatus, including:
a receiving unit, configured to receive a data frame to be sent, which is sent by a source device in a normal communication state;
the judging unit is used for sending a first response data frame to the information source equipment if the data frame to be sent is determined to be a non-response data frame;
when the data frame to be sent is a non-response data frame, the communication state of the information source equipment is a waiting response state; the first response data frame is used for determining that the data frame to be sent is received to the information source equipment, and indicating the information source equipment to change the waiting response state into the normal communication state.
A fifth aspect of an embodiment of the present invention provides a source device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method of the first aspect when executing the computer program.
A sixth aspect of the embodiments of the present invention provides a sink device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, the processor implementing the steps of the method of the first aspect described above when executing the computer program.
A seventh aspect of the embodiments of the present invention provides a computer readable storage medium storing a computer program which, when executed by a processor, implements the steps of the method of the first aspect described above.
Compared with the prior art, the embodiment of the invention has the beneficial effects that: when a data frame to be transmitted exists in a message queue, the current communication state of the information source equipment is obtained; if the current communication state is in a normal communication state, the data frame to be sent is sent to information sink equipment; if the data frame to be sent is a non-response data frame, changing the current communication state into a waiting response state; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device. According to the scheme, connection-oriented is not needed, and whether the data frame to be transmitted is transmitted or not is determined only according to the current communication state. And changing the current communication state according to the data frame type. And after the non-response data frame is sent, the data frame to be sent is sent again when the first response data frame returned by the information sink equipment is not received, so that the situations of abnormal data transmission, error code or frame loss and the like are avoided.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings that are required to be used in the embodiments or the related technical descriptions will be briefly described, and it is apparent that the drawings in the following description are only some embodiments of the present invention, and other drawings may be obtained according to the drawings without inventive effort for those skilled in the art.
Fig. 1 shows a schematic diagram of a connectionless-oriented communication method according to the present invention;
FIG. 2 shows a schematic flow chart of a data communication method provided by the invention;
FIG. 3 is a schematic diagram of a message queue provided by the present invention;
FIG. 4 shows a specific schematic flow chart of another data communication method provided by the present invention;
FIG. 5 shows a specific schematic flow chart of another data communication method provided by the present invention;
FIG. 6 shows a specific schematic flow chart of another data communication method provided by the present invention;
FIG. 7 shows a specific schematic flow chart of another data communication method provided by the present invention;
FIG. 8 shows a schematic flow chart of a data communication method provided by the present invention;
FIG. 9 shows a specific schematic flow chart of another data communication method provided by the present invention;
fig. 10 shows a schematic diagram of a data communication device provided by the present invention;
FIG. 11 is a schematic diagram of a data communication device according to the present invention;
FIG. 12 is a schematic diagram of a source device according to an embodiment of the present invention;
fig. 13 is a schematic diagram of a sink device according to an embodiment of the present invention.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth such as the particular system architecture, techniques, etc., in order to provide a thorough understanding of the embodiments of the present invention. It will be apparent, however, to one skilled in the art that the present invention may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present invention with unnecessary detail.
The embodiment of the invention provides a data communication method, a data communication device and terminal equipment, which are used for solving the technical problems that due to connectionless UDP communication, data transmission abnormality, error code or frame loss and the like are easy to occur.
The data communication method provided by the invention is suitable for one-to-one communication or one-to-many communication. The devices are connected through an Ethernet bus, and the inter-system devices perform information interaction in a handshake response mode, namely, all data frames sent by the information source device are required to be responded by the information sink device, and the information source device can send new data frames only after being responded or waiting for a specified timeout time so as to ensure that no abnormality exists in data transmission in network communication. The equipment realizes the information communication and control between the equipment through UDP communication protocol. Referring to fig. 1, fig. 1 shows a schematic diagram of a connectionless-oriented communication method according to the present invention. As shown in fig. 1, a command (to-be-transmitted data frame) sent by the node 1 to the node 2 needs to obtain a response (response data frame) returned by the node 2. The command (data frame to be sent) sent by the node 2 to the node 1 needs to get the response (response data frame) returned by the node 2. The specific communication process is as follows:
first, the present invention provides a data communication method. Referring to fig. 2, fig. 2 is a schematic flow chart of a data communication method provided by the present invention. As shown in fig. 2, the execution body of the data communication method is a source device, and includes the following steps:
Step 201: and when the data frame to be transmitted exists in the message queue, acquiring the current communication state of the information source equipment.
The invention is a retransmission mechanism based on UDP communication, and the retransmission mechanism needs a certain processing time length, so before transmitting the data frame to be transmitted, the data to be transmitted needs to be stored in a message queue (FIFO queue) so as to ensure that the data frame to be transmitted is transmitted after the last data frame is successfully transmitted, and prevent frame loss or frame error.
The message queue is shown in fig. 3, and fig. 3 shows a schematic diagram of the message queue provided by the invention. As shown in fig. 3, the message queue is a first-in first-out (FIFO) linear table that allows elements to be inserted only at one end of the table and deleted at the other end. One end that allows insertion is called a queue tail (rear), and one end that allows deletion is called a queue head (front). Then a [1] is the head element and a [5] is the tail element. The element which enters the message queue first is sent first, and only after the element which enters the message queue first comes out, the element which enters the message queue later can be sent.
The source device periodically determines whether there are data frames to be transmitted in the message queue. If the fact that the data frames to be sent do not exist in the message queue is determined, repeatedly determining whether the data frames to be sent exist in the message queue according to a preset period. And if the data frame to be transmitted exists in the message queue, acquiring the current communication state of the information source equipment. The data frame to be transmitted refers to a data frame that needs to be transmitted currently.
The current communication state of the source device includes, but is not limited to, a normal communication state, a wait for response state, a stop communication state, or an unknown state. The normal communication state refers to a communication state in which a data frame can be normally transmitted to the sink device. The wait response state refers to a communication state in which the sink device is waiting to return a response data frame. When the source equipment is in a waiting response state, the data frame cannot be sent, and the source equipment is only in a passive data frame receiving state. The source device can transmit a data frame to the sink device only when the waiting response state transitions to the normal communication state.
It will be appreciated that if the source device is in a normal communication state, this indicates that the last data frame has completed data communication (including both (1) the last data frame has been sent to the sink device and the sink device returned the correct response frame, and (2) the last data frame has been sent to the sink device but no response frame has been received and both the number of retransmissions and the retransmission duration have timed out). If the source device is in the waiting response state, the data frame to be sent in the message queue is sent to the sink device, but the response data frame returned by the sink device is not received temporarily, so that the sink device needs to wait for the response data frame to be returned.
As an alternative embodiment of the present invention, after step 201, steps A1 to A2 are further included. As shown in fig. 4, fig. 4 shows a specific schematic flowchart of another data communication method provided by the present invention.
Step A1: and if the current communication state is in a waiting response state, acquiring the retransmission times and the retransmission time length.
If the current communication state is in the waiting response state, the data frame to be sent is sent to the information sink device, but the response data frame returned by the information sink device is not received temporarily, and whether to resend the data frame to be sent to the information sink device is determined according to the resending times and resending time length.
Step A2: and if the retransmission times are smaller than a first threshold value and the retransmission time period is longer than a second threshold value, the data frame to be transmitted is retransmitted to the information sink equipment.
To prevent long waiting times for the sink device to return a response data frame, communication of subsequent data frames is affected. Therefore, the invention sets the retransmission times and the retransmission time length, and limits the total retransmission time length of the retransmission mechanism so as to avoid influencing the communication of the subsequent data frames. The retransmission time length refers to the time length of the last data frame transmitted from the current time.
The retransmission process of each data frame is controlled to be within a reasonable time range through the retransmission times and the retransmission time.
Preferably, the number of retransmissions and the retransmission duration may be set according to the amount of network data or the memory size, for example: the number of retransmissions and the retransmission duration may be set to 3 times and 50 milliseconds.
As an alternative embodiment of the present invention, step A3 is further included after step A1. As shown in fig. 5, fig. 5 shows a specific schematic flowchart of another data communication method provided by the present invention.
Step A3: and if the retransmission times are not less than the first threshold value and the retransmission time is longer than the second threshold value, discarding the data frame to be transmitted in the message queue and changing the current communication state into a normal communication state.
If the retransmission times exceed the first threshold value and the retransmission time exceeds the second threshold value, deleting the data frame to be transmitted in the message queue, and changing the current communication state to the normal communication state so as to carry out the communication flow of the subsequent data frame.
The number of times of discarding the data frames of the source device can also be counted, so that whether the source device or the sink device is abnormal or not can be determined according to the number of times of discarding the data frames.
Step 202: and if the current communication state is in a normal communication state, transmitting the data frame to be transmitted to the information sink equipment.
It is noted that there may be multiple data frames in the message queue, with the multiple data frames having different transmission orders. The data frame to be transmitted, which is transmitted to the sink device, refers to a data frame in which the first bit is arranged in the message queue.
When the current communication state is in the normal communication state, the last data frame is indicated to complete data communication, so the data frame to be transmitted can be transmitted to the sink device. And judging the data frame type of the data frame to be transmitted, wherein the data frame type comprises a response data frame and a non-response data frame. The non-response data frame is used to transmit target communication data, i.e., normal communication data, to the sink device. And the response data frame is used to indicate that a non-response data frame has been received.
As an alternative embodiment of the present invention, step B1 is also included after step 202. As shown in fig. 6, fig. 6 shows a specific schematic flowchart of another data communication method provided by the present invention.
Step B1: and if the data frame to be sent is the second response data frame, changing the current communication state to the normal communication state, and setting a retransmission counter to 0.
The second response data frame is used to indicate to the sink device that the non-response data frame sent by the sink device has been received. When the second response data frame is sent, the communication resource can be released, namely the current communication state is changed into the normal communication state, the retransmission counter is set to 0, the second response data frame is deleted from the message queue, and the communication flow of the next data frame is started.
Step 203: if the data frame to be sent is a non-response data frame, changing the current communication state into a waiting response state; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device.
If the data frame to be transmitted is determined to be a non-response data frame, the information sink equipment needs to wait for returning the response data frame, so that the current communication state needs to be changed into a waiting response state.
As an alternative embodiment of the invention, step C1 is also included after step 203. As shown in fig. 7, fig. 7 shows a specific schematic flowchart of another data communication method provided by the present invention.
Step C1: adding 1 to the retransmission counter and recording the current frame number of the data frame to be transmitted; the current frame sequence number is used for accumulating on the basis of the current frame sequence number when the data frame is transmitted subsequently.
The retransmission counter is used to count the number of retransmissions to control the total duration of the retransmission mechanism.
In order to ensure the correctness of data communication, the terminal device in the invention needs to check the frame number of the data frame after receiving the data frame, and check whether the frame number is continuous. Therefore, after the data frame to be transmitted is transmitted, the current frame sequence number of the data frame to be transmitted needs to be recorded so as to accumulate sequence numbers in the communication process of the subsequent data frames. Wherein, the frame sequence number in the data frame, the sequence number value controlled by the source, when the new data frame is sent out, the value increases from 0, and when the value exceeds 65535, the value is turned over to 0. The same frame number is used when the sink sends out the response frame.
Optionally, the transmission time of the data frame to be transmitted may also be recorded, so as to count the retransmission duration thereof.
As an alternative embodiment of the present invention, the message organization and transmission in the communication method of the present invention is performed in units of bytes. In multi-byte transmission, low bytes are sent first and then high bytes are sent over the network. For example: if 0x12AB is sent, then 0x12 is sent first. In 8 bits per byte, the high order bits are sent first and then the low order bits are sent.
In order to better understand the technical solution of the present invention, the adaptive description is made here of the composition structure of the data frame:
(1) the data types in the data frame are shown in table 1:
table 1:
(2) the basic data frame format composition is shown in table 2:
each data frame header consists of a sync header, a frame header, and data content as shown in table 2. All data are sequentially transmitted according to a specified content sequence, the frame header mark is 0xC3A53C5A, and the transmission sequence on the network is 0x5A, 0x3C, 0xA5 and 0xC3.
Table 2:
sequence number Fields Number of bytes Remarks
1 Synchronous head 4 0xC3A53C5A
2 Frame header 28
3 Data content N Cannot exceed 1024 bytes
(3) The frame header format definition in the data frame is shown in table 3 below:
table 3:
(4) the response results in the data frame are shown in table 4:
table 4:
(5) the communication states of the terminal device include four types shown in table 5:
table 5:
(6) the message format description of the data frame is shown in table 6:
table 6:
in this embodiment, when a data frame to be sent exists in a message queue, the current communication state of the source device is obtained; if the current communication state is in a normal communication state, the data frame to be sent is sent to information sink equipment; if the data frame to be sent is a non-response data frame, changing the current communication state into a waiting response state; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device. According to the scheme, connection-oriented is not needed, and whether the data frame to be transmitted is transmitted or not is determined only according to the current communication state. And changing the current communication state according to the data frame type. And after the non-response data frame is sent, the data frame to be sent is sent again when the first response data frame returned by the information sink equipment is not received, so that the situations of abnormal data transmission, error code or frame loss and the like are avoided.
Next, the present invention provides a data communication method. Referring to fig. 8, fig. 8 is a schematic flow chart of a data communication method provided by the present invention. As shown in fig. 8, the data communication method execution body is a sink device, including the steps of:
step 801: and receiving the data frame to be transmitted, which is transmitted by the source equipment in the normal communication state.
After receiving the data frame to be sent, the information sink equipment acquires the target IP and the port number in the data frame. And calling a corresponding callback function according to the target IP and the port number to process the data frame to be transmitted. First, the sink device checks the frame header and the frame length of the data frame to be transmitted. After the frame header and the frame length are checked without errors, determining the data type of the data frame to be transmitted, wherein the data type comprises a non-response data frame or a second response data frame.
As an alternative embodiment of the present invention, after step 801, steps D1 to D3 are further included. As shown in fig. 9, fig. 9 shows a specific schematic flowchart of another data communication method provided by the present invention.
Step D1: and if the data frame to be sent is determined to be the second response data frame, acquiring a response result in the response data frame.
Step D2: and if the response result is correct, acquiring a first frame sequence number of the response data frame.
Step D3: and if the first frame sequence number is correct and is continuous with the second sequence number of the last data frame, changing the current communication state into the normal communication state.
Step 802: and if the data frame to be transmitted is determined to be a non-response data frame, transmitting a first response data frame to the information source equipment. When the data frame to be sent is a non-response data frame, the communication state of the information source equipment is a waiting response state; the first response data frame is used for determining that the data frame to be sent is received to the information source equipment, and indicating the information source equipment to change the waiting response state into the normal communication state.
In this embodiment, according to the data frame type, a response frame check or a response frame transmission is performed, and the current communication state is changed. And after the non-response data frame is sent, the data frame to be sent is sent again when the first response data frame returned by the information sink equipment is not received, so that the situations of abnormal data transmission, error code or frame loss and the like are avoided.
Referring to fig. 10, fig. 10 is a schematic diagram of a data communication device according to the present invention, and fig. 10 is a schematic diagram of a data communication device according to the present invention, where the data communication device shown in fig. 10 includes:
an obtaining unit 1001, configured to obtain, when a data frame to be sent exists in a message queue, a current communication state of the source device;
a sending unit 1002, configured to send the data frame to be sent to a sink device if the current communication state is in a normal communication state;
a changing unit 1003, configured to change the current communication state to a waiting response state if the data frame to be sent is a non-response data frame; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device.
The invention provides a data communication device, which acquires the current communication state of information source equipment when a data frame to be transmitted exists in a message queue; if the current communication state is in a normal communication state, the data frame to be sent is sent to information sink equipment; if the data frame to be sent is a non-response data frame, changing the current communication state into a waiting response state; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device. According to the scheme, connection-oriented is not needed, and whether the data frame to be transmitted is transmitted or not is determined only according to the current communication state. And changing the current communication state according to the data frame type. And after the non-response data frame is sent, the data frame to be sent is sent again when the first response data frame returned by the information sink equipment is not received, so that the situations of abnormal data transmission, error code or frame loss and the like are avoided.
Referring to fig. 11, fig. 11 is a schematic diagram of a data communication device 11 according to the present invention, and fig. 11 is a schematic diagram of a data communication device according to the present invention, where the data communication device shown in fig. 11 includes:
a receiving unit 111, configured to receive a data frame to be transmitted, which is transmitted by the source device in a normal communication state;
a judging unit 112, configured to send a first response data frame to the source device if it is determined that the data frame to be sent is a non-response data frame;
when the data frame to be sent is a non-response data frame, the communication state of the information source equipment is a waiting response state; the first response data frame is used for determining that the data frame to be sent is received to the information source equipment, and indicating the information source equipment to change the waiting response state into the normal communication state.
The invention provides a data communication device, which performs response frame verification or response frame transmission according to the type of a data frame and changes the current communication state. And after the non-response data frame is sent, the data frame to be sent is sent again when the first response data frame returned by the information sink equipment is not received, so that the situations of abnormal data transmission, error code or frame loss and the like are avoided.
Fig. 12 is a schematic diagram of a source device according to an embodiment of the present invention. As shown in fig. 12, a source device 12 of this embodiment includes: a processor 12, a memory 121 and a computer program 122, for example a data communication method program, stored in the memory 121 and executable on the processor 12. The steps of each of the above-described embodiments of a data communication method, such as steps 201 through 203 shown in fig. 2, are implemented when the processor 12 executes the computer program 122. Alternatively, the processor 12, when executing the computer program 122, performs the functions of the units in the above-described device embodiments, for example, the functions of the units 1001 to 1003 shown in fig. 10.
Illustratively, the computer program 122 may be partitioned into one or more units that are stored in the memory 121 and executed by the processor 12 to complete the present invention. The one or more elements may be a series of computer program instruction segments capable of performing a specified function describing the execution of the computer program 122 in the one source device 12.
For example, the specific functions of the computer program 122 that may be partitioned into units are as follows:
An obtaining unit, configured to obtain a current communication state of the source device when a data frame to be sent exists in a message queue;
a transmitting unit, configured to transmit the data frame to be transmitted to a sink device if the current communication state is in a normal communication state;
a changing unit, configured to change the current communication state to a waiting response state if the data frame to be sent is a non-response data frame; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device.
Including but not limited to a processor 12 and a memory 121. It will be appreciated by those skilled in the art that fig. 12 is merely an example of one source device 12 and is not intended to be limiting of one source device 12, and may include more or fewer components than shown, or may combine certain components, or different components, e.g., the one source device may further include an input-output device, a network access device, a bus, etc.
The processor 12 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSPs), application specific integrated circuits (Application Specific Integrated Circuit, ASICs), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGAs) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 121 may be an internal storage unit of the source device 12, such as a hard disk or a memory of the source device 12. The memory 121 may also be an external storage device of the one source device 12, for example, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the one source device 12. Further, the memory 121 may also include both an internal storage unit and an external storage device of the one source device 12. The memory 121 is used to store the computer program and other programs and data required for the one roaming control device. The memory 121 may also be used to temporarily store data that has been output or is to be output.
Fig. 13 is a schematic diagram of a sink device according to an embodiment of the present invention. As shown in fig. 13, a sink device 13 of this embodiment includes: a processor 13, a memory 131 and a computer program 132 stored in the memory 131 and executable on the processor 13, for example a data communication method program. The steps of each of the above-described data communication method embodiments, such as steps 801 to 802 shown in fig. 8, are implemented when the processor 13 executes the computer program 132. Alternatively, the processor 13 may perform the functions of the units in the above-described embodiments of the apparatus, such as the functions of the units 111 to 112 shown in fig. 11, when executing the computer program 132.
Illustratively, the computer program 132 may be split into one or more units, which are stored in the memory 131 and executed by the processor 13 to complete the present invention. The one or more elements may be a series of computer program instruction segments capable of performing a specific function for describing the execution of the computer program 132 in the one sink device 13.
For example, the specific functions of the computer program 132 that may be partitioned into units are as follows:
A receiving unit, configured to receive a data frame to be sent, which is sent by a source device in a normal communication state;
the judging unit is used for sending a first response data frame to the information source equipment if the data frame to be sent is determined to be a non-response data frame;
when the data frame to be sent is a non-response data frame, the communication state of the information source equipment is a waiting response state; the first response data frame is used for determining that the data frame to be sent is received to the information source equipment, and indicating the information source equipment to change the waiting response state into the normal communication state.
Including but not limited to the processor 13 and the memory 131. It will be appreciated by those skilled in the art that fig. 13 is merely an example of one sink device 13 and does not constitute a limitation of one sink device 13, and may include more or less components than illustrated, or may combine certain components, or different components, e.g., the one sink device may further include an input-output device, a network access device, a bus, etc.
The processor 13 may be a central processing unit (Central Processing Unit, CPU), but may also be other general purpose processors, digital signal processors (Digital Signal Processor, DSP), application specific integrated circuits (Application Specific Integrated Circuit, ASIC), off-the-shelf programmable gate arrays (Field-Programmable Gate Array, FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 131 may be an internal storage unit of the one sink device 13, for example a hard disk or a memory of the one sink device 13. The memory 131 may also be an external storage device of the one sink device 13, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card) or the like, which are provided on the one sink device 13. Further, the memory 131 may also include both an internal storage unit and an external storage device of the one sink device 13. The memory 131 is used to store the computer program and other programs and data required for the one roaming control device. The memory 131 may also be used to temporarily store data that has been output or is to be output.
It should be understood that the sequence number of each step in the foregoing embodiment does not mean that the execution sequence of each process should be determined by the function and the internal logic, and should not limit the implementation process of the embodiment of the present invention.
It should be noted that, because the content of information interaction and execution process between the above devices/units is based on the same concept as the method embodiment of the present invention, specific functions and technical effects thereof may be referred to in the method embodiment section, and will not be described herein.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-described division of the functional units and modules is illustrated, and in practical application, the above-described functional distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules, so as to perform all or part of the functions described above. The functional units and modules in the embodiment may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit, where the integrated units may be implemented in a form of hardware or a form of a software functional unit. In addition, the specific names of the functional units and modules are only for distinguishing from each other, and are not used for limiting the protection scope of the present invention. The specific working process of the units and modules in the above system may refer to the corresponding process in the foregoing method embodiment, which is not described herein again.
Embodiments of the present invention also provide a computer readable storage medium storing a computer program which, when executed by a processor, implements steps for implementing the various method embodiments described above.
Embodiments of the present invention provide a computer program product which, when run on a mobile terminal, causes the mobile terminal to perform steps that enable the implementation of the method embodiments described above.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the present invention may implement all or part of the flow of the method of the above embodiments, and may be implemented by a computer program to instruct related hardware, where the computer program may be stored in a computer readable storage medium, and when the computer program is executed by a processor, the computer program may implement the steps of each of the method embodiments described above. Wherein the computer program comprises computer program code which may be in source code form, object code form, executable file or some intermediate form etc. The computer readable medium may include at least: any entity or device capable of carrying computer program code to a photographing device/terminal apparatus, recording medium, computer Memory, read-Only Memory (ROM), random access Memory (Random Access Memory, RAM), electrical carrier signals, telecommunications signals, and software distribution media. Such as a U-disk, removable hard disk, magnetic or optical disk, etc. In some jurisdictions, computer readable media may not be electrical carrier signals and telecommunications signals in accordance with legislation and patent practice.
In the foregoing embodiments, the descriptions of the embodiments are emphasized, and in part, not described or illustrated in any particular embodiment, reference is made to the related descriptions of other embodiments.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the solution. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present invention.
In the embodiments provided in the present invention, it should be understood that the disclosed apparatus/network device and method may be implemented in other manners. For example, the apparatus/network device embodiments described above are merely illustrative, e.g., the division of the modules or units is merely a logical functional division, and there may be additional divisions in actual implementation, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection via interfaces, devices or units, which may be in electrical, mechanical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units.
It should be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in the present specification and the appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes such combinations.
As used in the present description and the appended claims, the term "if" may be interpreted as "when..once" or "in response to a determination" or "in response to a detection" depending on the context. Similarly, the phrase "if a determination" or "if a [ described condition or event ] is monitored" may be interpreted in the context of meaning "upon determination" or "in response to determination" or "upon monitoring a [ described condition or event ]" or "in response to monitoring a [ described condition or event ]".
Furthermore, the terms "first," "second," "third," and the like in the description of the present specification and in the appended claims, are used for distinguishing between descriptions and not necessarily for indicating or implying a relative importance.
Reference in the specification to "one embodiment" or "some embodiments" or the like means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the invention. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," and the like in the specification are not necessarily all referring to the same embodiment, but mean "one or more but not all embodiments" unless expressly specified otherwise. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless expressly specified otherwise.
The above embodiments are only for illustrating the technical solution of the present invention, and not for limiting the same; although the invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical scheme described in the foregoing embodiments can be modified or some technical features thereof can be replaced by equivalents; such modifications and substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention.

Claims (10)

1. A data communication method, wherein the data communication method is applied to a source device, the data communication method comprising:
when a data frame to be sent exists in the message queue, the current communication state of the information source equipment is obtained;
if the current communication state is in a normal communication state, the data frame to be sent is sent to information sink equipment;
if the data frame to be sent is a non-response data frame, changing the current communication state into a waiting response state; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device.
2. The data communication method according to claim 1, further comprising, after the step of acquiring the current communication state of the source device when there is a data frame to be transmitted in the message queue:
if the current communication state is in a waiting response state, obtaining the retransmission times and the retransmission duration;
And if the retransmission times are smaller than a first threshold value and the retransmission time period is longer than a second threshold value, the data frame to be transmitted is retransmitted to the information sink equipment.
3. The data communication method according to claim 2, further comprising, after the step of acquiring the number of retransmissions and the retransmission duration if the current communication state is in a wait response state:
and if the retransmission times are not less than the first threshold value and the retransmission time is longer than the second threshold value, discarding the data frame to be transmitted in the message queue and changing the current communication state into a normal communication state.
4. The data communication method according to claim 1, further comprising, after the step of transmitting the data frame to be transmitted if the current communication state is in a normal communication state:
and if the data frame to be sent is the second response data frame, changing the current communication state to the normal communication state, and setting a retransmission counter to 0.
5. The data communication method according to claim 1, further comprising, after the step of changing the current communication state to a waiting response state if the data frame to be transmitted is a non-response data frame:
Adding 1 to the retransmission counter and recording the current frame number of the data frame to be transmitted; the current frame sequence number is used for accumulating on the basis of the current frame sequence number when the data frame is transmitted subsequently.
6. A data communication method, the data communication method being applied to a sink device, the data communication method comprising:
receiving a data frame to be transmitted, which is transmitted by the source equipment in a normal communication state;
if the data frame to be sent is determined to be a non-response data frame, a first response data frame is sent to the information source equipment;
when the data frame to be sent is a non-response data frame, the communication state of the information source equipment is a waiting response state; the first response data frame is used for determining that the data frame to be sent is received to the information source equipment, and indicating the information source equipment to change the waiting response state into the normal communication state.
7. The data communication method according to claim 6, further comprising, after the step of receiving the data frame to be transmitted, which is transmitted by the source device in the normal communication state:
if the data frame to be sent is determined to be a second response data frame, a response result in the response data frame is obtained;
If the response result is correct, acquiring a first frame sequence number of the response data frame;
and if the first frame sequence number is correct and is continuous with the second sequence number of the last data frame, changing the current communication state into the normal communication state.
8. A data communication apparatus, the data communication apparatus comprising:
an obtaining unit, configured to obtain a current communication state of the source device when a data frame to be sent exists in a message queue;
a transmitting unit, configured to transmit the data frame to be transmitted to a sink device if the current communication state is in a normal communication state;
a changing unit, configured to change the current communication state to a waiting response state if the data frame to be sent is a non-response data frame; the waiting response state is used for retransmitting the data frame to be transmitted when the first response data frame returned by the information sink equipment is not received; the first response data frame is used for determining that the data frame to be sent is received to the source equipment; the non-response data frame is used for transmitting target communication data to the sink device.
9. A source device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any of claims 1 to 5 when the computer program is executed.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method according to any one of claims 1 to 7.
CN202211442561.8A 2022-11-17 2022-11-17 Data communication method and device and terminal equipment Pending CN116488778A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211442561.8A CN116488778A (en) 2022-11-17 2022-11-17 Data communication method and device and terminal equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211442561.8A CN116488778A (en) 2022-11-17 2022-11-17 Data communication method and device and terminal equipment

Publications (1)

Publication Number Publication Date
CN116488778A true CN116488778A (en) 2023-07-25

Family

ID=87220139

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211442561.8A Pending CN116488778A (en) 2022-11-17 2022-11-17 Data communication method and device and terminal equipment

Country Status (1)

Country Link
CN (1) CN116488778A (en)

Similar Documents

Publication Publication Date Title
EP0525985B1 (en) High speed duplex data link interface
CA2674655C (en) Improved data transfer method, system and protocol
US10645145B2 (en) Method and apparatus for accelerating data transmission in a network communication system
US7760629B2 (en) Aggregate data frame generation
EP2978171B1 (en) Communication method, communication device, and communication program
KR20070001892A (en) Reducing number of write operations relative to delivery of out-of-order rdma send messages
US6973096B2 (en) System and method for processing bandwidth allocation messages
CN112242956B (en) Flow rate control method and device
CN116582492B (en) Congestion control method, system and storage medium for optimizing RDMA reading
CN115994048B (en) Chip, communication method, system and storage medium
CN116566921A (en) Congestion control method, system and storage medium for remote direct memory access reading
US20130275837A1 (en) Packet forward error correction
JP7210867B2 (en) Acknowledgment packet transmission method and communication device
CN116614445B (en) Data transmission method and related device thereof
CN115955447B (en) Data transmission method, switch and switch system
CN116488778A (en) Data communication method and device and terminal equipment
CN112351049B (en) Data transmission method, device, equipment and storage medium
CN115633104A (en) Data sending method, data receiving method, device and data receiving and sending system
US11435999B2 (en) Method and apparatus for upgrading software
CN117560304B (en) Network state monitoring method, system, equipment and medium
EP4075697A1 (en) Message transmission method and electronic device
CN115242682A (en) Message processing method and device, electronic equipment and computer readable storage medium
US20230403219A1 (en) High speed data packet pcap capture and storage with error detection-correction
CN117768407A (en) Data processing method and server
CN117978327A (en) SPI communication-based data frame sending method, SPI communication-based data frame sending device, SPI communication-based data frame communication method and SPI communication-based data frame sending system

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