CN107426770B - Data communication method, data terminal and system based on data link layer - Google Patents

Data communication method, data terminal and system based on data link layer Download PDF

Info

Publication number
CN107426770B
CN107426770B CN201710604945.8A CN201710604945A CN107426770B CN 107426770 B CN107426770 B CN 107426770B CN 201710604945 A CN201710604945 A CN 201710604945A CN 107426770 B CN107426770 B CN 107426770B
Authority
CN
China
Prior art keywords
data
terminal
data frame
block
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710604945.8A
Other languages
Chinese (zh)
Other versions
CN107426770A (en
Inventor
黄进
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
GD Midea Air Conditioning Equipment Co Ltd
Original Assignee
GD Midea Air Conditioning Equipment 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 GD Midea Air Conditioning Equipment Co Ltd filed Critical GD Midea Air Conditioning Equipment Co Ltd
Priority to CN201710604945.8A priority Critical patent/CN107426770B/en
Publication of CN107426770A publication Critical patent/CN107426770A/en
Application granted granted Critical
Publication of CN107426770B publication Critical patent/CN107426770B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/06Optimizing the usage of the radio link, e.g. header compression, information sizing, discarding information
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/04Error control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W80/00Wireless network protocols or protocol adaptations to wireless operation
    • H04W80/02Data link layer protocols

Abstract

The invention discloses a data communication method, a data terminal and a system based on a data link layer, wherein the data communication method carries out a plurality of data block processing through a data packet of a first terminal in a data frame to be sent and sends the data packet to a second terminal, the data packet comprises checksum information corresponding to each data block, the second terminal sends a response data frame to the first terminal after receiving the data frame, and the first terminal only sends the data frame containing data block errors according to the response data frame. Compared with the prior art that all data packets are repeatedly sent when data errors occur, the embodiment of the invention only sends the wrong data blocks when the data frame is sent in the next time, so that the data volume of the data frame is greatly reduced relatively for the first time, the error rate of data transmission is greatly reduced, and the effective throughput rate and the transmission efficiency of data in a wireless network are further improved.

Description

Data communication method, data terminal and system based on data link layer
Technical Field
The present invention relates to the field of wireless network data communication, and in particular, to a data communication method, a data terminal, and a system based on a data link layer.
Background
With the popularization of mobile terminal devices such as mobile phones, wireless network communication based on the mobile terminal devices is more and more widely applied compared with the prior wired network, and the current wireless network communication protocol such as WIFI is formed by modifying based on the prior wired network communication protocol. In a wired network environment, the success rate of data transmission is high, when network congestion occurs, data message loss generally occurs, and in a wireless network environment, because the reliability of a transmission medium is greatly reduced, the error code of a link replaces the network congestion to become a main cause of data packet loss, and at the moment, the traditional network protocol still judges the packet loss of the network as congestion, so that the congestion window of a sending end can be mistakenly reduced, and the effective throughput rate and the transmission efficiency in wireless network communication can be reduced.
The above is only for the purpose of assisting understanding of the technical aspects of the present invention, and does not represent an admission that the above is prior art.
Disclosure of Invention
The invention mainly aims to provide a data communication method, a data terminal and a system based on a data link layer, and aims to solve the problem that the effective throughput rate and the transmission efficiency are reduced when the existing communication network protocol is applied to a wireless network.
In order to achieve the above object, the present invention provides a data communication method based on a data link layer, where the data communication method based on the data link layer includes:
a first terminal divides a data packet in a data frame to be sent into a plurality of data blocks;
the first terminal calculates the checksum of each data block, encapsulates the data frame containing the checksum and the data blocks according to a preset communication protocol and sends the data frame to a second terminal, wherein the second terminal analyzes the data frame sent by the first terminal, determines the data block with an error according to the checksum of the data frame, and generates and feeds back a response data frame according to the data block with the error;
and when receiving a response data frame sent by the second terminal, the first terminal identifies a data block with an error in sending according to the response data frame, repackages the data block with the error in sending into a data frame and sends the data frame to the second terminal.
Preferably, before encapsulating the data frame including the checksum and the data block, the first terminal further includes:
constructing data block quantity information and data block identification information in the data frame, wherein the data block identification information comprises identification information corresponding to each data block, so that the identification information is modified when the second terminal identifies that the data block is wrong, and the sending error of the data block is identified;
the first terminal identifying the data block with the transmission error according to the response data frame comprises the following steps:
and the first terminal identifies identification information corresponding to each data block of the response data frame, and determines a corresponding data block sending error according to a modified value in the identification information.
Preferably, before encapsulating the data frame including the checksum and the data block, the first terminal further includes:
and constructing block identification information in the data frame to identify whether the data frame is blocked or not, so that when the second terminal receives the block identification information in the data frame, the second terminal determines to send an error data block according to the checksum of the data frame.
Preferably, the calculating the checksum of each data block and adding the checksum information to the corresponding data block further includes:
and calculating the checksum of the header data positioned in the data frame before the position of the data packet, and adding the checksum information into the data frame so that the second terminal can check the header data according to the checksum information of the header data.
In order to achieve the above object, the present invention further provides a data communication method based on a data link layer, where the data communication method based on the data link layer includes:
the second terminal receives the data frame sent by the first terminal, and checks a plurality of data blocks in the data frame respectively;
modifying corresponding identification information according to the data blocks with the errors checked so as to identify the data block errors with the errors checked;
and encapsulating the response data frame containing the modified identification information and sending the response data frame to the first terminal, wherein when the first terminal receives the response data frame sent by the second terminal, the first terminal identifies a data block with an error in sending according to the response data frame, and encapsulates the data block with the error in sending again into the data frame and sends the data frame to the second terminal.
Preferably, before the second terminal respectively checks and checks the plurality of data blocks in the received data frame, the method further includes:
identifying block identification information in the data frame;
and when the data frame is confirmed to contain the block data according to the block identification information, performing verification and check processing on the block data of the data frame.
Preferably, before the second terminal receives the data frame sent by the first terminal, the method further includes:
a first terminal divides a data packet in a data frame to be sent into a plurality of data blocks;
and the first terminal calculates the checksum of each data block, encapsulates the data frame containing the checksum and the data block according to a preset communication protocol and sends the encapsulated data frame to the second terminal.
Preferably, before encapsulating the data frame containing the plurality of data blocks, the first terminal further includes:
the first terminal constructs quantity information of data blocks and data block identification information in the data frame, wherein the data block identification information comprises identification information corresponding to each data block, so that the identification information is modified when the second terminal identifies that the data blocks are wrong, and the sending errors of the data blocks are identified.
In order to achieve the above object, the present invention further provides a data terminal, including:
a first controller;
a first memory; and
a first application program of a data link layer based data communication method, wherein the first application program is stored in the first memory, the first application program implementing the steps of the data link layer based data communication method applied to the first terminal.
In order to achieve the above object, the present invention further provides a data terminal, including:
a second controller;
a second memory; and
a second application program of the data link layer based data communication method, wherein the second application program is stored in the first memory, and the second application program implements the steps of the data link layer based data communication method applied to the second terminal.
In order to achieve the above object, the present invention further provides a data communication system based on a data link layer, wherein the wireless network data communication system includes:
the first terminal is used for dividing a data packet in a transmitted data frame into a plurality of data blocks; and
calculating the checksum of each data block, packaging the data frame containing the checksum and the data block according to a preset communication protocol, and sending the data frame to a second terminal; and
when receiving a response data frame sent by the second terminal, the first terminal identifies a data block with an error in sending according to the response data frame, repackages the data block with the error in sending into a data frame and sends the data frame to the second terminal;
the second terminal receives the data frame sent by the first terminal and respectively checks and verifies a plurality of data blocks in the data frame; and
modifying corresponding identification information according to the data blocks with the errors checked so as to identify the data block errors with the errors checked; and
and encapsulating the response data frame containing the modified identification information and transmitting the response data frame to the first terminal.
The invention provides a data communication method based on a data link layer.A first terminal divides a data packet in a data frame to be sent into a plurality of data blocks, calculates the checksum of each data block, adds the checksum information into the corresponding data block, constructs data block quantity information and data block identification information in the data frame, wherein the data block quantity information comprises the quantity information of the data blocks, and the data block identification information comprises identification information corresponding to each data block, so that the identification information is modified when a second terminal identifies that the data block is wrong, the data block is identified to send the mistake, and finally, the data frame comprising the data blocks, the data block quantity information and the data block identification information is packaged and sent to the second terminal; after receiving the data frame, the second terminal respectively checks and checks a plurality of data blocks in the data frame, modifies corresponding identification information according to the data blocks with wrong checks to identify data block data errors with wrong checks, and then encapsulates the response data frame containing the modified identification information and sends the response data frame to the first terminal; and when receiving the response data frame subsequently, the first terminal identifies the data block with the transmission error according to the response data frame, repackages the data block with the transmission error into the data frame and sends the data frame to the second terminal. Compared with the prior art that all data packets are repeatedly sent when data errors occur, the embodiment of the invention only sends the wrong data blocks when the data frame is sent later, so that the data volume of the data frame is greatly reduced for the first time, the error rate of data transmission is greatly reduced, and the effective throughput rate and the transmission efficiency of data in wireless network communication are further improved.
Drawings
Fig. 1 is a schematic flow chart illustrating a first sending of a data frame according to a first embodiment of a data communication method of the present invention;
fig. 2 is a schematic diagram of a first-time-sent data frame structure according to a first embodiment of the data communication method of the present invention;
FIG. 3 is a flowchart illustrating a subsequent data frame transmission according to a first embodiment of the data communication method of the present invention;
FIG. 4 is a flowchart illustrating a data communication method according to a third embodiment of the present invention;
fig. 5 is a schematic flowchart illustrating interaction between a first terminal and a second terminal in a data communication method according to a fourth embodiment of the present invention;
fig. 6 is a functional block diagram of a data communication system according to a fifth embodiment of the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the descriptions relating to "first", "second", etc. in the present invention are for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the embodiments of the present invention, "a plurality" means two or more unless specifically limited otherwise. In addition, technical solutions between various embodiments may be combined with each other, but must be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, such a combination should not be considered to exist, and is not within the protection scope of the present invention.
In the following embodiments of the data communication method, the data terminal and the data communication system provided by the present invention, the first terminal and the second terminal have a wireless network access function, including but not limited to: the related data communication method is applied to a wireless network, and is based on an 802.11 protocol family standard, which corresponds to a second layer, namely a data link layer, in an Open System Interconnection (OSI) data reference model, wherein the protocol family standard is an implementation mode of applying the data link layer to the wireless network, the data link layer is between a physical layer and a network layer, the basic function of the data link layer is to provide a transparent and reliable data transmission basic service for a layer user, the content, format and coding of data transmitted on the layer are not limited, and the meaning of an information structure does not need to be explained, the data link layer is the enhancement of the function of transmitting an original bit stream on the physical layer, and the purpose is to enhance the function of transmitting the original bit stream on the basis of an original physical transmission line with errors, the method of error detection, error control and flow control is adopted to improve the physical line with errors into a data link without errors logically, and provide high-quality service for a network layer.
The DATA link layer is different from and transparent to the TCP transport layer and the IP network layer, which correspond to DATA processing of a DATA packet part in a DATA frame of the DATA link layer, and the DATA frame of the DATA link layer includes other DATA such as MAC Header part DATA in addition to the DATA packet (DATA): a Frame Control field (Frame Control), Duration (Duration), Address field (Address), Sequence Control field (Sequence Control), and the like, which refer to the Frame structure of the existing 802.11 protocol.
Fig. 1 is a schematic flow chart of a data communication method based on a data link layer according to an embodiment of the present invention, where the data communication method is applied to a first terminal for data communication in a wireless network, as shown in fig. 1, the data communication method includes the following steps:
step S101, a first terminal divides a data packet in a data frame to be sent into a plurality of data blocks;
the DATA frame of the embodiment of the present invention is based on the improvement of the frame structure of the 802.11 protocol, and divides the DATA packet (DATA) part in the original frame structure into a plurality of blocks, as shown in the schematic diagram of the DATA frame structure shown in fig. 2, wherein the DATA packet (DATA) part is divided into a plurality of blocks from DATA1, DATA2 to datab, and the DATA length occupied by each DATA block can be set to be the same.
Step S102, a first terminal calculates the checksum of each data block, encapsulates a data frame containing the checksum and the data block according to a preset communication protocol and sends the encapsulated data frame to a second terminal, wherein the second terminal analyzes the data frame sent by the first terminal, determines a data block with an error according to the checksum of the data frame, and generates and feeds back a response data frame according to the data block with the error;
as shown in fig. 2, a checksum is calculated for each data block, where the checksum occupies two bytes, that is, a 16-bit checksum, and after the checksum of each data block is added to the corresponding data block, as shown in the figure, the checksum — 1 of the data block data1 is set after the data block data1, and the checksum — 2 of the data block data2 is set after the data block data2, which facilitates later identification of the checksum data.
Further, since the entire DATA Frame includes other DATA besides the DATA packet (DATA), a portion before the DATA packet (DATA) in fig. 2 is called header DATA, and includes DATA information such as a Frame Control field (Frame Control), a Duration (Duration), an Address field (Address), a Sequence Control field (Sequence Control), and the like. For the accuracy of the data transmission process, it is further required to calculate a checksum on the header data, and then add the checksum data to the data frame, where checksum in fig. 2 is the checksum of the header data, and is located after the entire data frame, preferably located at the end of the entire data frame, so as to facilitate the identification of the second terminal.
Further, before encapsulating the data frame including the checksum and the data block, the first terminal further includes:
constructing quantity information of data blocks and data block identification information in a data frame, wherein the data block identification information comprises identification information corresponding to each data block, so that when a second terminal identifies that the data block is wrong, the identification information is modified to identify the sending mistake of the data block;
the first terminal identifying the data block with the transmission error according to the response data frame comprises the following steps:
and the first terminal identifies identification information corresponding to each data block of the response data frame and determines a corresponding data block sending error according to a modified value in the identification information.
The data frame of this embodiment further includes data block number information and data block identification information, as shown in fig. 2, where the data block number information corresponds to fragnum in the drawing, and occupies 0.5 bytes, that is, 4 bits. The data block identification information includes fragmark in the identification information corresponding diagram corresponding to each data block, and is used to identify whether the corresponding data block is correct, 2 bytes, that is, 16 bits, are occupied, each bit corresponds to one of the data blocks, and a specific data value of each bit may uniformly use 1 or 0 to identify whether the data is correct, for example, a1 identifies that the corresponding transmitted data block is correct. Since fragnum has only 4 bits and fragmark has 16 bits, at most 16 data blocks can be identified, corresponding to data1, data2 through data16 data blocks in the graph, and at this time, corresponding checksum information also ranges from checksum _1, checksum _2 through checksum _ 16.
The number information of the data blocks and the data block identification information are improvements on the frame data structure of the existing 802.11 protocol, and are advantageous to multiplex some of the existing data information bytes, because some of the data bytes of the existing protocol frame are not available for termination of different periods in the data transmission process, such as transmission and reception, and therefore can be multiplexed for different periods, and the bytes are redefined as the data block number information and the data block identification information. The arrangement in fig. 2 in which the number information fragnum of the data chunks is located in the header data portion and the data chunk identification information fragmark is located immediately before, i.e. before, the checksum of the header data also facilitates identification with the second terminal.
And encapsulating the data partitioned in the step, the quantity information of the data blocks and the identification information of the data blocks, and sending the encapsulated data to the second terminal, so that the data of the first terminal can be sent. Here, the sending to the second terminal may be directly sending to the second terminal in the local area network, or forwarding to the second terminal device in the local area network via the server; or may be forwarded to the second terminal of the remote end via the server. The server herein provides an Access Point (AP) capable device for a wireless network for forwarding data frames from a first terminal to a second terminal via the wireless network; or the data frame is forwarded to the server, the server analyzes the data frame, and the analyzed data frame is forwarded to the second terminal. For example, a simple server may be a conventional wireless switch suitable for use in a local area network in a short distance, and two devices such as smart phones carrying a wireless network card may communicate with each other in the local area network through the wireless router. Of course, the server may further be an extended AP, such as a wireless router, which can access a wired internet network through the wireless router to implement interconnection communication between two remote mobile devices, in addition to implementing interconnection between the mobile devices in a short distance.
Further, after the step S102, the method further includes:
step S103, when receiving the response data frame sent by the second terminal, the first terminal identifies the data block with the transmission error according to the response data frame, and repackages the data block with the transmission error into the data frame and sends the data frame to the second terminal.
And the second terminal analyzes the data of the data frame received from the server and makes a response, and sends a corresponding response data frame to the second terminal through the server. As shown in fig. 3, the response data frame includes data block identification information fragmark, which includes identification information of whether each block data in the data packet is correct. Whether the corresponding block time is correct can be confirmed by analyzing each bit of data of fragmark bytes, for example, if the default data bit value 1 is correct in identification, if a certain bit of data is received, the data block data corresponding to the identification is incorrect, which indicates that the second terminal does not correctly receive the data block.
When the first terminal identifies that the data block has errors according to the data block identification information fragmark in the response data frame, the first terminal encapsulates the data block with errors into the data frame next time and sends the data frame to the server again.
For example, when the identification bits 0 of the first and data chunk identification information chunks data1 and data2 of the data chunk identification information fragmark are identified, it is determined that the data chunk is not correctly received by the second terminal, and then the first terminal encapsulates the first and data chunk identification information chunks data1 and data2 into the data frame again next time, and sends the header data and the checksum of the header data and the data chunk identification information fragmark information encapsulated into the data frame to the server. The data frame transmitted at this time only contains the error data blocks, so that the data volume of the data frame is greatly reduced compared with that of the data frame transmitted at the first time. In the prior art, all data packets are repeatedly transmitted when a data error occurs, so that the length of a data frame is the same as that of the data frame transmitted for the first time.
The data communication method based on the data link layer divides a data packet in a data frame to be sent into a plurality of data blocks through a first terminal, calculates the checksum of each data block, adds the checksum information into the corresponding data block, simultaneously constructs data block quantity information and data block identification information in the data frame, wherein the data block quantity information comprises the quantity information of the data blocks, the data block identification information comprises identification information corresponding to each data block, so that the identification information is modified when a second terminal identifies that the data block is wrong, the data block sending error is identified, and finally, the data frame containing the data blocks, the data block quantity information and the data block identification information is packaged and sent to the second terminal; and when a response data frame sent by the second terminal is received subsequently, identifying the data block with the transmission error according to the response data frame, repackaging the data block with the transmission error into the data frame and sending the data frame to the second terminal. Compared with the prior art that all data packets are repeatedly sent when data errors occur, the embodiment of the invention only sends the wrong data blocks when the data frame is sent in the next time, so that the data volume of the data frame is greatly reduced relatively for the first time, the error rate of data transmission is greatly reduced, and the effective throughput rate and the transmission efficiency of data in a wireless network are further improved.
Further, based on the data communication method based on the data link layer according to the first embodiment of the present invention, in the data communication method based on the data link layer according to the second embodiment of the present invention, the constructing the data block quantity information and the data block identification information in the data frame further includes:
and constructing block identification information in the data frame to identify whether the data frame is blocked or not, so that when the second terminal receives the block identification information in the data frame, the second terminal determines to send an erroneous data block according to the checksum of the data frame.
Because the data frame of the embodiment of the invention is based on the improvement of the frame structure of the 802.11 protocol, in order to be compatible with the original frame of the existing 802.11 protocol, the original data frame can be added with a piece of block identification information to identify whether the data frame is blocked or not. As shown in fig. 2, in the byte located in the Frame Control field (Frame Control) in the data Frame, mf bit therein is represented as the blocking identification information again, when the bit value is 1, it represents that the data Frame performs the blocking process on the data packet, and when the bit value is 0, it represents that the data Frame does not perform the blocking process on the data packet. When the value of the mf bit is 0, the current frame structure of the 802.11 protocol is obtained, so that the compatibility with the frame structure of the current 802.11 protocol is realized.
Fig. 4 is a flowchart illustrating a data communication method based on a data link layer according to a third embodiment of the present invention, where the data communication method is applied to a second terminal for data communication in a wireless network, as shown in fig. 4, the data communication method includes the following steps:
step S201, a second terminal receives a data frame sent by a first terminal, and checks a plurality of data blocks in the data frame respectively;
after receiving the data frame sent by the first terminal, the second terminal respectively checks and checks a plurality of data blocks in the data frame, specifically, the check sum of each data block is calculated and checked with the check sum of the corresponding data block to determine whether the data block is wrong, and if the calculated check sum is inconsistent with the check sum contained in the data packet, the data block is indicated to have data errors.
Step S202, modifying corresponding identification information according to the data block with error checking to identify the data block with error checking;
when it is determined that a data error occurs in a data block, the identification information of the corresponding data block, i.e., the data block identification information fragmark mentioned in embodiment 1, is modified, and the corresponding identification bit value is specifically modified, for example, when an error occurs in the data block data1, the corresponding bit value in the data block identification information fragmark is modified to 0 to identify the data error in the data block data1, and if the data is correct, the corresponding bit value in the data block identification information fragmark is still maintained.
Step S203, packaging the response data frame containing the modified identification information and sending the response data frame to the first terminal, wherein when the first terminal receives the response data frame sent by the second terminal, the first terminal identifies the data block with the transmission error according to the response data frame, and repackages the data block with the transmission error into the data frame and sends the data frame to the second terminal.
And encapsulating the processed data frame containing the data block identification information fragmark to form a response data frame and sending the response data frame to the first terminal, so as to finish the sending of the response data frame of the second terminal.
Further, based on the data communication method based on the data link layer according to the third embodiment of the present invention, in the data communication method based on the data link layer according to the fourth embodiment of the present invention, before checking and collating the plurality of data blocks in the received data frame, the method further includes:
identifying block identification information in the data frame;
and when the data frame is confirmed to contain the block data according to the block identification information, performing verification and check processing on the block data of the data frame.
When the identification information mf of a data block is added to a data frame sent by a first terminal corresponding to the first embodiment, after a second terminal receives the data frame from a server, the value of the identification information mf is determined, and when it is determined that the data frame contains block data, the subsequent processing step of the data frame containing the block data is executed.
For example, when the identification information mf bit data value of the block is identified to be 1, it indicates that the data frame protects the data block information, and then the subsequent processing step of the data frame containing the block data is executed; and if the mf bit data value is identified to be 0, identifying that the data frame does not contain the block data information, wherein the data frame is a frame of the existing 802.11 protocol and only needs to be processed according to the processing mode of the existing data frame.
Fig. 5 is a schematic flowchart illustrating an interaction between a first terminal and a second terminal of a data communication method based on a data link layer according to a fourth embodiment of the present invention, where the flowchart includes the following steps:
step S301, a first terminal divides a data packet in a data frame to be sent into a plurality of data blocks;
step S302, the first terminal calculates the checksum of each data block;
step S303, constructing data block quantity information and data block identification information in a data frame, wherein the data block identification information comprises identification information corresponding to each data block, so that when the second terminal identifies that the data block is wrong, the identification information is modified to identify the sending mistake of the data block;
step S304, the first terminal encapsulates a data frame containing a checksum, a plurality of data blocks, data block quantity information and data block identification information;
step S305, the first terminal sends the encapsulated data frame to the second terminal;
step S306, the second terminal checks and checks the plurality of data blocks in the received data frame respectively;
step S307, the second terminal modifies the identification information of the data block according to the data block with error checking so as to identify the data block with error checking;
step S308, packaging the response data frame containing the modified identification information;
step S309, the second terminal sends the response data frame which is packaged to the first terminal;
step S310, the first terminal receives the response data frame and identifies and sends wrong data blocks according to the response data frame;
step S311, the first terminal repackages the data block containing the transmission error into a data frame;
in step S312, the first terminal sends the repackaged data frame to the second terminal.
The steps S301 to S305 related to the first terminal processing are implemented as steps S101 to S102 in the first embodiment of the present invention, the steps S306 to S309 related to the subsequent second terminal processing are implemented as steps S201 to S203 in the third embodiment of the present invention, and the steps S310 to S312 related to the subsequent first terminal processing are implemented as step S103 in the first embodiment of the present invention. Therefore, the interactive process that the first terminal carries out blocking processing on the data packet of the data frame and sends the data packet to the second terminal, the second terminal carries out processing according to the received data frame containing the blocking data and sends the response data frame to the first terminal, and the first terminal sends the corresponding data frame for protecting the blocking data information according to the response data frame is realized.
A fifth embodiment of the present invention provides a data communication system 100 based on a data link layer, as shown in fig. 6, the data communication system 100 includes: a first terminal 10 and a second terminal 20.
A first terminal 10 for transmitting data frames to a second terminal via a wireless network. The first terminal 10 includes a first controller 11 and a first memory 12, and the first memory 12 stores therein a first application 13 that is executable on the first controller 11.
A second terminal 20 for receiving the data frame from the first terminal. The second terminal 20 includes a second controller 21 and a second memory 22, and the second memory 22 stores a second application 23 that can be executed on the second controller 21.
The application 13 of the data communication method applied to the first terminal 10 in the wireless data communication system 100 is stored in the memory 12, and the controller 11 executes the application 13 to implement the data communication method in the above-mentioned embodiment 1 and embodiment 2 of the present invention. And an application program 23 of the data communication method applied to the second terminal 20 in the wireless network data communication system 100, wherein the application program 23 is stored in the memory 22, and the controller 21 executes the application program 23 to implement the data communication method in the above-mentioned embodiment 3 and embodiment 4 of the present invention.
For example, the application 13 executes the data communication method instructions in the following steps:
step S101, a first terminal divides a data packet in a data frame to be sent into a plurality of data blocks;
step S102, a first terminal calculates the checksum of each data block, encapsulates a data frame containing the checksum and the data block according to a preset communication protocol and sends the encapsulated data frame to a second terminal, wherein the second terminal analyzes the data frame sent by the first terminal, determines a data block with an error according to the checksum of the data frame, and generates and feeds back a response data frame according to the data block with the error;
step S103, when receiving the response data frame sent by the second terminal, the first terminal identifies the data block with the transmission error according to the response data frame, and repackages the data block with the transmission error into the data frame and sends the data frame to the second terminal.
For example, the application 23 executes the data communication method instructions in the following steps:
step S201, a second terminal receives a data frame sent by a first terminal, and checks a plurality of data blocks in the data frame respectively;
step S202, modifying corresponding identification information according to the data block with error checking to identify the data block with error checking;
step S203, packaging the response data frame containing the modified identification information and sending the response data frame to the first terminal, wherein when the first terminal receives the response data frame sent by the second terminal, the first terminal identifies the data block with the transmission error according to the response data frame, and repackages the data block with the transmission error into the data frame and sends the data frame to the second terminal.
In describing embodiments of the present invention, it should be noted that any process or method descriptions in flow charts or otherwise described herein may be understood as representing modules, segments, or portions of code which include one or more executable instructions for implementing specific logical functions or steps of the process, and that the scope of the preferred embodiments of the present invention includes additional implementations in which functions may be executed out of order from that shown or discussed, including substantially concurrently or in reverse order, depending on the functionality involved, as would be understood by those reasonably skilled in the art of the present invention.
The logic and/or steps represented in the flowcharts or otherwise described herein, such as an ordered listing of executable instructions that can be considered to implement logical functions, can be embodied in any computer-readable medium for use by or in connection with an instruction execution system, apparatus, or device, such as a computer-based system, processing module-containing system, or other system that can fetch the instructions from the instruction execution system, apparatus, or device and execute the instructions. For the purposes of this description, a "computer-readable storage medium" can be any means that can contain, store, communicate, propagate, or transport the program for use by or in connection with the instruction execution system, apparatus, or device. More specific examples (a non-exhaustive list) of the computer-readable medium would include the following: an electrical connection (electronic device) having one or more wires, a portable computer diskette (magnetic device), a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable storage medium may even be paper or another suitable medium upon which the program is printed, as the program can be electronically captured, via for instance optical scanning of the paper or other medium, then compiled, interpreted or otherwise processed in a suitable manner if necessary, and then stored in a computer memory.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (9)

1. A data communication method based on a data link layer is characterized in that the data communication method based on the data link layer comprises the following steps:
a first terminal divides a data packet in a data frame to be sent into a plurality of data blocks;
the first terminal calculates the checksum of each data block, encapsulates the data frame containing the checksum and the data blocks according to a preset communication protocol and sends the data frame to a second terminal, wherein the second terminal analyzes the data frame sent by the first terminal, determines the data block with an error according to the checksum of the data frame, and generates and feeds back a response data frame according to the data block with the error;
when receiving a response data frame sent by the second terminal, the first terminal identifies a data block with a sending error according to the response data frame, repackages the data block with the sending error into a data frame and sends the data frame to the second terminal, wherein the data frame only contains the data block with the sending error;
wherein before encapsulating the data frame including the checksum and the data block, the first terminal further includes:
constructing data block quantity information and data block identification information in the data frame, wherein the data block identification information comprises identification information corresponding to each data block, so that the identification information is modified when the second terminal identifies that the data block is wrong, and the sending error of the data block is identified;
the first terminal identifying the data block with the transmission error according to the response data frame comprises the following steps:
and the first terminal identifies identification information corresponding to each data block of the response data frame, and determines a corresponding data block sending error according to a modified value in the identification information.
2. The data communication method of claim 1, wherein the first terminal further comprises before encapsulating the data frame including the checksum and the data block:
and constructing block identification information in the data frame to identify whether the data frame is blocked or not, so that when the second terminal receives the block identification information in the data frame, the second terminal determines to send an error data block according to the checksum of the data frame.
3. The data communication method of claim 1, wherein the calculating a checksum for each data block and adding the checksum information to the corresponding data block further comprises:
and calculating the checksum of the header data positioned in the data frame before the position of the data packet, and adding the checksum information into the data frame so that the second terminal can check the header data according to the checksum information of the header data.
4. A data communication method based on a data link layer is characterized in that the data communication method based on the data link layer comprises the following steps:
the second terminal receives the data frame sent by the first terminal, and checks a plurality of data blocks in the data frame respectively;
modifying corresponding identification information according to the data blocks with the errors checked so as to identify the data block errors with the errors checked;
packaging and sending the response data frame containing the modified identification information to the first terminal, wherein when the first terminal receives the response data frame sent by the second terminal, the first terminal identifies the data block with the transmission error according to the response data frame, repackages the data block with the transmission error into the data frame and sends the data frame to the second terminal, and the data frame only contains the data block with the transmission error;
wherein before encapsulating the data frame containing the plurality of data blocks, the first terminal further comprises:
the first terminal constructs quantity information of data blocks and data block identification information in the data frame, wherein the data block identification information comprises identification information corresponding to each data block, so that the identification information is modified when the second terminal identifies that the data blocks are wrong, and the sending errors of the data blocks are identified.
5. The data communication method as claimed in claim 4, wherein before the second terminal checks and checks the plurality of data blocks in the received data frame, the method further comprises:
identifying block identification information in the data frame;
and when the data frame is confirmed to contain the block data according to the block identification information, performing verification and check processing on the block data of the data frame.
6. The data communication method according to claim 4 or 5, wherein before the second terminal receives the data frame transmitted by the first terminal, the method further comprises:
a first terminal divides a data packet in a data frame to be sent into a plurality of data blocks;
and the first terminal calculates the checksum of each data block, encapsulates the data frame containing the checksum and the data block according to a preset communication protocol and sends the encapsulated data frame to the second terminal.
7. A data terminal, characterized in that the data terminal comprises:
a first controller;
a first memory; and
first application program of a data link layer based data communication method, wherein the first application program is stored in the first memory, the first application program implementing the steps of the data link layer based data communication method according to any one of claims 1 to 3.
8. A data terminal, characterized in that the data terminal comprises:
a second controller;
a second memory; and
second application program of a data link layer based data communication method, wherein the second application program is stored in the second memory, the second application program implementing the steps of the data link layer based data communication method according to claim 4 or 5.
9. A data communication system based on a data link layer, the data communication system based on the data link layer comprising:
the first terminal is used for dividing a data packet in a transmitted data frame into a plurality of data blocks; and
calculating the checksum of each data block, packaging the data frame containing the checksum and the data block according to a preset communication protocol, and sending the data frame to a second terminal; and
when receiving a response data frame sent by the second terminal, the first terminal identifies a data block with a sending error according to the response data frame, repackages the data block with the sending error into a data frame and sends the data frame to the second terminal, wherein the data frame only contains the data block with the sending error;
the second terminal receives the data frame sent by the first terminal and respectively checks and verifies a plurality of data blocks in the data frame; and
modifying corresponding identification information according to the data blocks with the errors checked so as to identify the data block errors with the errors checked; and
encapsulating and transmitting a response data frame containing the modified identification information to the first terminal;
wherein before encapsulating the data frame including the checksum and the data block, the first terminal further includes:
constructing data block quantity information and data block identification information in the data frame, wherein the data block identification information comprises identification information corresponding to each data block, so that the identification information is modified when the second terminal identifies that the data block is wrong, and the sending error of the data block is identified;
the first terminal identifying the data block with the transmission error according to the response data frame comprises the following steps:
and the first terminal identifies identification information corresponding to each data block of the response data frame, and determines a corresponding data block sending error according to a modified value in the identification information.
CN201710604945.8A 2017-07-21 2017-07-21 Data communication method, data terminal and system based on data link layer Active CN107426770B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710604945.8A CN107426770B (en) 2017-07-21 2017-07-21 Data communication method, data terminal and system based on data link layer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710604945.8A CN107426770B (en) 2017-07-21 2017-07-21 Data communication method, data terminal and system based on data link layer

Publications (2)

Publication Number Publication Date
CN107426770A CN107426770A (en) 2017-12-01
CN107426770B true CN107426770B (en) 2021-09-14

Family

ID=60431026

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710604945.8A Active CN107426770B (en) 2017-07-21 2017-07-21 Data communication method, data terminal and system based on data link layer

Country Status (1)

Country Link
CN (1) CN107426770B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110875795B (en) * 2018-08-29 2022-05-24 阿里巴巴集团控股有限公司 Data transmission method, device, equipment and storage medium
CN109194593A (en) * 2018-08-29 2019-01-11 百度在线网络技术(北京)有限公司 Method for sending information, device, equipment and computer readable storage medium
CN110267348B (en) * 2019-05-27 2022-08-02 中国联合网络通信集团有限公司 Data transmission method and equipment
CN112055314B (en) * 2019-06-28 2021-09-24 合肥炬芯智能科技有限公司 Bluetooth broadcast communication method, system and master device and slave device thereof
CN116610272A (en) * 2023-04-23 2023-08-18 珠海芯烨电子科技有限公司 Processing method and system for picture data of printing terminal

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7191384B2 (en) * 2002-10-17 2007-03-13 Qualcomm Incorporated Method and apparatus for transmitting and receiving a block of data in a communication system
CN103595504B (en) * 2013-11-04 2017-07-28 上海数字电视国家工程研究中心有限公司 The method for packing and method of calibration of packet

Also Published As

Publication number Publication date
CN107426770A (en) 2017-12-01

Similar Documents

Publication Publication Date Title
CN107426770B (en) Data communication method, data terminal and system based on data link layer
CN107835040B (en) Data communication method, equipment and storage medium based on Bluetooth
CN111083161A (en) Data transmission processing method and device and Internet of things equipment
US20130016724A1 (en) Link layer preemption
CN103595504A (en) Encapsulation method and calibration method for data package
CN108737259A (en) Gateway device, data transmission method and storage medium
CN111556136A (en) Data interaction method between internal containers of power edge Internet of things agent
CN106603506B (en) Data communication method, device and system based on multi-field bus
CN110855686B (en) SPI protocol communication method, system, equipment and computer storage medium
EP3057256B1 (en) Method for processing stream media message, wifi chip and mobile terminal
WO2021088813A1 (en) Packet encapsulating method and apparatus, and packet decapsulating method and apparatus
CN110214439B (en) Data transmission method, device, sending end, receiving end and system
CN113872735A (en) Data transmission method, device and equipment
CN109525374B (en) Data transmission method, wireless access point, user equipment and transmission equipment
CN107257265B (en) Real-time transmission data stream forward error correction, system, device and storage medium
KR100810358B1 (en) Method for confirming integrity of container and the dvb-h terminal
US11196792B2 (en) Method, device and system for transmitting data
CN112910838B (en) Composite protocol analysis method, device, equipment, system and storage medium
WO2023051050A1 (en) Network monitoring method and apparatus, and computer storage medium
CN113630404B (en) Protocol message transmission method, device, storage medium and terminal
CN112039801B (en) Method, system and proxy server for setting IP information
CN110138505B (en) CRC calculation method and system for heterogeneous protocol conversion
CN110198202B (en) Method and device for checking AFDX (avionics full Duplex switched Ethernet) bus message data source
CN115729879A (en) Data frame format, chip communication method and chip
CN111339020A (en) Serial port data receiving and transmitting method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant