CN112566082B - Data transmission method, device, equipment and medium - Google Patents
Data transmission method, device, equipment and medium Download PDFInfo
- Publication number
- CN112566082B CN112566082B CN202011279089.1A CN202011279089A CN112566082B CN 112566082 B CN112566082 B CN 112566082B CN 202011279089 A CN202011279089 A CN 202011279089A CN 112566082 B CN112566082 B CN 112566082B
- Authority
- CN
- China
- Prior art keywords
- data
- packet
- test
- sending
- length
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04W—WIRELESS COMMUNICATION NETWORKS
- H04W4/00—Services specially adapted for wireless communication networks; Facilities therefor
- H04W4/80—Services using short range communication, e.g. near-field communication [NFC], radio-frequency identification [RFID] or low energy communication
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The application is applicable to the technical field of computers, and provides a data transmission method, which comprises the following steps: in response to receiving a connection establishment request sent by a data sender, sending test data packets with different lengths to the data sender, and receiving response data returned by the data sender aiming at each test data packet; determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet; and the determined maximum transmission packet length is sent to a data sending party, so that the data sending party sends data to a data receiving party based on the maximum transmission packet length. The method and the device can determine the maximum transmission packet length suitable for data transmission between the data sender and the data receiver based on the actual data transmission condition between the data sender and the data receiver, and are beneficial to improving the data transmission efficiency.
Description
Technical Field
The present application belongs to the field of computer technologies, and in particular, to a data transmission method, apparatus, device, and medium.
Background
Bluetooth (bluetooth) is an open global specification for wireless data and voice communications, a low-cost, short-range wireless connection technology. In the related art, because data transmitted once through the bluetooth technology is limited, when a data transmitting side transmits data to a data receiving side through the bluetooth technology, if the transmitted data is large, the large data needs to be split into a plurality of data packets before being transmitted. In practical applications, if the packet length of the split data packet is smaller, the number of times of transmission required for the same data is larger, and a larger transmission time is required. If the packet length of the split data packet is larger, the probability that the data packet is interfered in the transmission process is larger, and once transmission errors occur, data retransmission is caused, and more transmission time is consumed.
Therefore, in the related art, in order to realize faster transmission of data, the split length of the data packet needs to be determined.
Disclosure of Invention
The embodiment of the application provides a data transmission method, a data transmission device, data transmission equipment and a data transmission medium.
In a first aspect, an embodiment of the present application provides a data transmission method, where the method includes:
in response to receiving a connection establishment request sent by a data sending party, sending test data packets with different lengths to the data sending party, and receiving response data returned by the data sending party for each test data packet;
determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet;
and the determined maximum transmission packet length is sent to a data sending party, so that the data sending party sends data to a data receiving party based on the maximum transmission packet length.
Further, sending test data packets with different lengths to the data sending party, and receiving response data returned by the data sending party for each test data packet, includes:
a data sending step: sending a test data packet with an initial length to a data sending party, and receiving response data returned by the data sending party aiming at the test data packet with the initial length;
in response to the initial length being less than the preset length threshold, taking a sum of the initial length and a preset value as a new initial length, and continuing to perform the data transmission step based on the new initial length.
Further, determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet, includes:
regarding to a test data packet in each test data packet, recording the sending time of the test data packet as a first time, and recording the receiving time of response data corresponding to the test data packet as a second time; and determining the difference value between the second time and the first time as the transmission time length of the test data packet.
Further, before sending test data packets with different lengths to a data sending party and receiving response data returned by the data sending party for each test data packet, the method further includes:
and sending a test instruction for controlling the data sending party to switch to the test state to the data sending party so as to enable the data sending party to switch to the test state.
Further, sending the determined maximum transmission packet length to a data sender so that the data sender sends data to a data receiver based on the maximum transmission packet length, comprising:
and sending a packet length instruction for controlling the data sending party to send data with the determined maximum transmission packet length to the data sending party, so that the data sending party sends the data to the data receiving party based on the maximum transmission packet length indicated by the packet length instruction.
Further, the response data corresponding to the test data packet is a corresponding test data packet.
In a second aspect, the present application provides a data transmission system, which includes a data sending party and a data receiving party, wherein,
the data sender is used for sending a connection establishment request to the data receiver;
the data receiving party is used for responding to the received connection establishment request sent by the data sending party, sending test data packets with different lengths to the data sending party and receiving response data returned by the data sending party aiming at each test data packet; determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet; determining the length of the test data packet with the minimum corresponding transmission time length as the maximum transmission packet length, and sending the determined maximum transmission packet length to a data sending party;
and the data sender is used for sending data to the data receiver based on the maximum transmission packet length.
Further, in the data receiving side, sending test data packets with different lengths to the data sending side, and receiving response data returned by the data sending side for each test data packet, the method includes:
a data sending step: sending a test data packet with an initial length to a data sender, and receiving response data returned by the data sender aiming at the test data packet with the initial length;
in response to the initial length being less than the preset length threshold, taking a sum of the initial length and a preset value as a new initial length, and continuing to perform the data transmission step based on the new initial length.
Further, in the data receiving side, determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet, includes:
regarding to a test data packet in each test data packet, recording the sending time of the test data packet as a first time, and recording the receiving time of response data corresponding to the test data packet as a second time; and determining the difference value between the second time and the first time as the transmission duration of the test data packet.
Further, before sending test data packets with different lengths to the data sender and receiving response data returned by the data sender for each test data packet, the data receiver further includes:
and sending a test instruction for controlling the data sending party to switch to the test state to the data sending party so as to enable the data sending party to switch to the test state.
Further, in the data receiving side, sending the determined maximum transmission packet length to the data sending side, so that the data sending side sends data to the data receiving side based on the maximum transmission packet length, including:
and sending a packet length instruction for controlling the data sending party to send data with the determined maximum transmission packet length to the data sending party, so that the data sending party sends the data to the data receiving party based on the maximum transmission packet length indicated by the packet length instruction.
Further, in the data receiving side, the response data corresponding to the test data packet is a corresponding test data packet.
In a third aspect, an embodiment of the present application provides a data transmission apparatus, including:
the data sending unit is used for responding to a connection establishment request sent by a data sending party, sending test data packets with different lengths to the data sending party and receiving response data returned by the data sending party aiming at each test data packet;
a time length determining unit, configured to determine a transmission time length of each test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet;
and the packet length determining unit is used for determining the length of the test data packet with the minimum corresponding transmission time length as the maximum transmission packet length and sending the determined maximum transmission packet length to the data sending party, so that the data sending party sends data to the data receiving party based on the maximum transmission packet length.
Further, sending test data packets with different lengths to the data sending party, and receiving response data returned by the data sending party for each test data packet, includes:
a data sending step: sending a test data packet with an initial length to a data sender, and receiving response data returned by the data sender aiming at the test data packet with the initial length;
in response to the initial length being less than the preset length threshold, taking a sum of the initial length and a preset value as a new initial length, and continuing to perform the data transmission step based on the new initial length.
Further, the duration determining unit is specifically configured to:
regarding to a test data packet in each test data packet, recording the sending time of the test data packet as a first time, and recording the receiving time of response data corresponding to the test data packet as a second time; and determining the difference value between the second time and the first time as the transmission time length of the test data packet.
Further, before sending test data packets with different lengths to a data sending party and receiving response data returned by the data sending party for each test data packet, the method further includes:
and sending a test instruction for controlling the data sending party to switch to the test state to the data sending party so as to enable the data sending party to switch to the test state.
Further, sending the determined maximum transmission packet length to a data sender so that the data sender sends data to a data receiver based on the maximum transmission packet length, comprising:
and sending a packet length instruction for controlling the data sending party to send data with the determined maximum transmission packet length to the data sending party, so that the data sending party sends the data to the data receiving party based on the maximum transmission packet length indicated by the packet length instruction.
Further, the response data corresponding to the test data packet is a corresponding test data packet.
In a fourth aspect, an embodiment of the present application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the processor executes the computer program, the steps of the data transmission method are implemented.
In a fifth aspect, an embodiment of the present application provides a computer-readable storage medium, where a computer program is stored, and when the computer program is executed by a processor, the steps of the data transmission method are implemented.
In a sixth aspect, an embodiment of the present application provides a computer program product, which, when run on an electronic device, causes the electronic device to execute the data transmission method of any one of the above first aspects.
Compared with the related art, the embodiment of the application has the beneficial effects that: the maximum transmission packet length suitable for data transmission between the data sender and the data receiver can be determined based on the actual data transmission condition between the data sender and the data receiver. Therefore, when the data required to be sent by the data sender is large, the data can be split by the maximum transmission packet length, so that the split data packets can be quickly transmitted to the data receiver, and the data transmission efficiency can be improved.
It is understood that the beneficial effects of the second to sixth aspects can be seen from the description of the first aspect, and are not described herein again.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required to be used in the embodiments or the related technical descriptions will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a system architecture diagram of an application of a data transmission method provided in an embodiment of the present application;
fig. 2 is a schematic flowchart of a data transmission method according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a data transmission system according to an embodiment of the present application;
fig. 4 is a timing diagram of a data transmission method according to an embodiment of the present application;
fig. 5 is a schematic structural diagram of a data transmission device according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application 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 application with unnecessary detail.
It will 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 this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing or implying relative importance.
Reference throughout this 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 present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless expressly specified otherwise.
In order to explain the technical means of the present application, the following examples are given below.
Referring to fig. 1, a system architecture diagram of an application of a data transmission method according to an embodiment of the present application is shown.
As shown in fig. 1, the system architecture may include a vehicle 101, a data collection device 102, and a vehicle diagnostic device 103.
The vehicle 101 may be various vehicles. Such as unmanned vehicles, cars, trucks, etc. It is noted that the vehicle 101 may also be a variety of other vehicles. Such as an aircraft, a ship.
The data collection device 102 may be a device for collecting data of a vehicle. The data collection device 102 may transmit the collected vehicle data to the vehicle diagnosis device 103 through the bluetooth technology. At this time, the data collection device 102 is the data sender, and the vehicle diagnosis device 103 is the data receiver.
The vehicle diagnosis device 103 may include, but is not limited to, various terminal devices such as a smart phone, a tablet computer, a laptop portable computer, and a desktop computer, and the present embodiment is not particularly limited. The vehicle diagnosis equipment can respond to the received connection establishment request sent by the data sender, send test data packets with different lengths to the data sender, and receive response data returned by the data sender aiming at each test data packet; determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet; and the determined maximum transmission packet length is sent to a data sending party, so that the data sending party sends data to a data receiving party based on the maximum transmission packet length. Therefore, the maximum transmission packet length suitable for data transmission between the data sender and the data receiver can be determined based on the actual data transmission condition between the data sender and the data receiver. Therefore, when the data required to be sent by the data sender is large, the data can be split by the maximum transmission packet length, so that the split data packets can be quickly transmitted to the data receiver, and the data transmission efficiency is improved.
Referring to fig. 2, a schematic flow chart of a data transmission method provided in an embodiment of the present application is shown, where the data transmission method shown in fig. 2 includes:
In practice, the data sender may be implemented as a terminal, a device, a server, etc. The data receiver may be implemented as a terminal, device, server, etc.
The connection establishment request is generally information for requesting establishment of a communication connection.
The test packets are typically packets used for testing. The response data is generally data for responding to the test packet.
In the present embodiment, the execution subject of the data transmission method is generally the data receiving side (e.g., the vehicle diagnostic apparatus 103 shown in fig. 1). The execution main body can receive a connection establishment request sent by a data sending party in a Bluetooth connection mode. After receiving the connection establishment request, the execution main body can send test data packets with different lengths to the data sending party in a Bluetooth connection mode. In this way, the data sender can receive test data packets with different lengths and return response data to the data receiver for each test data packet. The execution body can receive response data returned by the data sender. In particular, for each test data packet, a corresponding reply data may be received.
The transmission duration generally refers to a duration consumed for transmitting data. The transmission duration of the test packet generally refers to the duration consumed by transmitting the test packet.
In this embodiment, for each test data packet, the execution main body may determine the transmission duration of the test data packet according to the sending time of the test data packet and the response data corresponding to the test data packet. For example, for a test packet a, if the sending time of the test packet is T1 and the receiving time of the response data corresponding to the test packet is T2, the execution body may determine that the transmission time duration of the test packet is T, and T = (T2-T1) ÷ 2.
The maximum transmission packet length generally refers to a length of a data packet suitable for transmission between a data transmitting side and a data receiving side.
In this embodiment, one transmission duration may be obtained for each test packet. The execution subject may select a test packet corresponding to a minimum transmission duration from among the plurality of test packets. The length of the selected test packet is then determined as the maximum transmission packet length. Finally, the execution body may send the determined maximum transmission packet length to the data sender. Thus, the data transmitting side can transmit data to the data receiving side based on the maximum transmission packet length. In practice, if the size of data to be sent by a data sender is 1000 bytes, the maximum transmission packet length is 256 bytes. Then, the data sender may split the 1000 bytes of data into 4 data packets for transmission, and the size of each data packet may be: 256 bytes, 232 bytes.
It should be noted that the smaller the corresponding transmission duration, the less time consumed for transmitting the test data packet is generally indicated, and the length of the test data packet is more suitable for transmission between the data sending side and the data receiving side.
In this embodiment, the maximum transmission packet length suitable for data transmission between the data sender and the data receiver may be determined based on the actual data transmission situation between the data sender and the data receiver. Therefore, when the data required to be sent by the data sender is large, the data can be split by the maximum transmission packet length, so that the split data packets can be quickly transmitted to the data receiver, and the data transmission efficiency can be improved.
In some optional implementation manners of this embodiment, the sending test packets with different lengths to the data sender, and receiving response data returned by the data sender for each test packet includes: a data sending step: the method comprises the steps of sending a test data packet with an initial length to a data sending party, and receiving response data returned by the data sending party aiming at the test data packet with the initial length. In response to the initial length being less than the preset length threshold, taking a sum of the initial length and a preset value as a new initial length, and continuing to perform the data transmission step based on the new initial length.
Wherein the initial length is a preset value by default. E.g., may be 64.
The preset length threshold may be a preset value for representing an upper limit. The preset value may be a preset value for indicating the amount of addition.
In this implementation, the execution main body may first send a test packet with an initial length to the data sender. Then, response data returned by the data sender aiming at the test data is received. Then, the execution body may update the initial length, that is, add the initial length to a preset value to obtain a new initial length. Then, the data transmission step is continued using the updated initial length. Until the initial length is greater than or equal to a preset length threshold. According to the implementation mode, a plurality of test data packets with the same length interval can be obtained, the length of each test data packet is uniformly distributed, and the maximum transmission packet length which is more suitable for data transmission between a data sending party and a data receiving party can be determined. Thereby contributing to further improvement of data transmission efficiency.
In some optional implementation manners of this embodiment, the determining the transmission duration of each test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet includes: regarding a test data packet in each test data packet, recording the sending time of the test data packet as a first time, and recording the receiving time of response data corresponding to the test data packet as a second time; and determining the difference value between the second time and the first time as the transmission duration of the test data packet.
For example, for a test packet a, if the sending time of the test packet is T1 and the receiving time of the response data corresponding to the test packet is T2, the execution main body may determine that the transmission duration of the test packet is T, and T = T2-T1.
In this implementation, for each test packet, the execution main body may calculate a transmission duration. The time length consumed for transmitting the test data packet can be obtained by subtracting the sending time of the test data packet from the receiving time of the corresponding response data.
In some optional implementation manners of this embodiment, before sending test data packets with different lengths to a data sender and receiving response data returned by the data sender for each test data packet, the method further includes: and sending a test instruction for controlling the data sending party to switch to the test state to the data sending party so as to enable the data sending party to switch to the test state.
The test command is typically a command for controlling the data sending end to switch to the test state. The test state is typically the state in which reply data is returned for a received test packet.
Here, the execution body may transmit the test instruction to the data transmission side after receiving the connection establishment request and before transmitting the test packet to the data transmission side. In this way, the data receiver may enter a test state based on the test instruction. In the test state, the data sender may return response data for each test data packet.
The implementation mode can realize that the data sender sends the test data packet to the data sender when the data sender is in the test state, and can realize that the data sender accurately responds to the test data packet.
In some optional implementation manners of this embodiment, the sending the determined maximum transmission packet length to the data sending side, so that the data sending side sends data to the data receiving side based on the maximum transmission packet length, includes: and sending a packet length instruction for controlling the data sending party to send data with the determined maximum transmission packet length to the data sending party, so that the data sending party sends the data to the data receiving party based on the maximum transmission packet length indicated by the packet length instruction.
The packet length command is generally a command for controlling the data transmitting side to transmit data with a maximum transmission packet length.
In this implementation, the execution main body may send a packet length instruction to the data sender. Thus, the data transmitting side can transmit data to the data receiving side based on the maximum transmission packet length indicated by the packet length instruction. Therefore, when the data required to be sent by the data sender is large, the data can be split by the maximum transmission packet length, so that the split data packets can be quickly transmitted to the data receiver, and the data transmission efficiency is improved.
In an optional implementation manner of each embodiment of the present application, the response data corresponding to the test data packet is a corresponding test data packet.
In this implementation, when receiving the test data packet sent by the data receiver, the data sender can directly return the original packet of the test data packet. The method is technically convenient to realize and is beneficial to improving the data processing efficiency.
With continuing reference to fig. 3, a data transmission system 300 provided for the embodiment of the present application may include a data sender 301 and a data receiver 302, where:
a data sender 301, configured to send a connection establishment request to a data receiver;
the data receiving party 302 is configured to send test data packets with different lengths to the data sending party in response to receiving a connection establishment request sent by the data sending party, and receive response data returned by the data sending party for each test data packet; determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet; determining the length of the test data packet with the minimum corresponding transmission time length as the maximum transmission packet length, and sending the determined maximum transmission packet length to a data sending party;
a data transmitting side 301, configured to transmit data to a data receiving side based on the maximum transmission packet length.
In this embodiment, the maximum transmission packet length suitable for data transmission between the data sender and the data receiver may be determined based on the actual data transmission condition between the data sender and the data receiver. Therefore, when the data required to be sent by the data sender is large, the data can be split by the maximum transmission packet length, so that the split data packets can be quickly transmitted to the data receiver, and the data transmission efficiency is improved.
In some embodiments, in the data receiving side, sending test data packets with different lengths to the data sending side, and receiving response data returned by the data sending side for each test data packet, includes:
a data sending step: sending a test data packet with an initial length to a data sending party, and receiving response data returned by the data sending party aiming at the test data packet with the initial length;
in response to the initial length being less than the preset length threshold, taking a sum of the initial length and a preset value as a new initial length, and continuing to perform the data transmission step based on the new initial length.
In some embodiments, in the data receiving side, determining the transmission duration of each test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet includes:
regarding to a test data packet in each test data packet, recording the sending time of the test data packet as a first time, and recording the receiving time of response data corresponding to the test data packet as a second time; and determining the difference value between the second time and the first time as the transmission time length of the test data packet.
In some embodiments, before sending test data packets with different lengths to the data sender and receiving response data returned by the data sender for each test data packet, the data receiver further includes:
and sending a test instruction for controlling the data sending party to switch to the test state to the data sending party so as to enable the data sending party to switch to the test state.
In some embodiments, in the data receiver, sending the determined maximum transmission packet length to the data sender, so that the data sender sends data to the data receiver based on the maximum transmission packet length, includes:
and sending a packet length instruction for controlling the data sending party to send data with the determined maximum transmission packet length to the data sending party, so that the data sending party sends the data to the data receiving party based on the maximum transmission packet length indicated by the packet length instruction.
In some embodiments, in the data receiver, the response data corresponding to the test data packet is a corresponding test data packet.
It should be noted that, because the above-mentioned information interaction, execution process and other contents between the data sending party and the data receiving party are based on the same concept as the method embodiment of the present application, the specific functions and technical effects thereof may be referred to specifically in the method embodiment section, and are not described herein again.
With continuing reference to fig. 4, fig. 4 is a timing diagram of a data transmission method provided by an embodiment of the present application. The specific implementation process of the data transmission method provided by the application can include the following steps:
in step 401, the master device waits for a slave device pairing connection.
Here, the master device is a data receiving side, and the slave device is a data transmitting side.
In step 402, the slave device searches for bluetooth and connects with the master device in a pairing manner.
In step 403, the master device sends a test instruction to the slave device.
Here, the test instruction is generally an instruction for controlling switching from the device to the test state. The test state is typically the state in which reply data is returned for a received test packet.
The master device may send test instructions to the slave device after receiving the connection establishment request and before sending the test data packet to the slave device. In this way, the slave device may enter a test state based on the test instruction. In the test state, the slave device may return response data for each test packet.
At step 404, the master device sends a test packet of an initial length to the slave device.
Here, the initial length is preset in the host device, and a preset length threshold for defining the upper limit size of the test packet is preset.
Step 405, the slave device receives the test packet and returns the received test packet as it is.
In step 406, the master device receives the test data packet returned from the slave device, and calculates the time consumption of the current test data packet.
Here, the above-mentioned elapsed time is a transmission time period. The master device may obtain the transmission duration by subtracting the sending time of the test packet from the receiving time of the test packet.
In step 407, the primary device updates the initial length, and if the value of the updated initial length is smaller than the preset length threshold, the steps 404 to 406 are continuously executed.
In step 408, the master device finds the minimum consumed time from the calculated consumed times, and determines the length of the test data packet corresponding to the minimum consumed time as the maximum transmission packet length.
In step 409, the master device sends the maximum transmission packet length to the slave device.
In step 410, the slave device saves the maximum transmission packet length to realize the subsequent data transmission to the master device based on the maximum transmission packet length.
Here, when the slave device needs to send data to the master device, if the data is greater than the maximum transmission packet length, the slave device may split the data by the maximum transmission packet length, so as to realize fast transmission of the split data packet to the master device, which is beneficial to improving data transmission efficiency.
Further referring to fig. 5, corresponding to the data transmission method of the above embodiment, fig. 5 is a block diagram of a data transmission device 500 provided in the embodiment of the present application, and for convenience of description, only the parts related to the embodiment of the present application are shown.
Referring to fig. 5, the apparatus includes:
a data sending unit 501, configured to send test data packets with different lengths to a data sender in response to receiving a connection establishment request sent by the data sender, and receive response data returned by the data sender for each test data packet;
a time length determining unit 502, configured to determine a transmission time length of each test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet;
a packet length determining unit 503, configured to determine the length of the test data packet with the smallest corresponding transmission time length as a maximum transmission packet length, and send the determined maximum transmission packet length to the data sending side, so that the data sending side sends data to the data receiving side based on the maximum transmission packet length.
In some embodiments, sending test data packets with different lengths to a data sender, and receiving response data returned by the data sender for each test data packet, includes:
a data sending step: sending a test data packet with an initial length to a data sender, and receiving response data returned by the data sender aiming at the test data packet with the initial length;
in response to the initial length being less than the preset length threshold, taking a sum of the initial length and a preset value as a new initial length, and continuing to perform the data transmission step based on the new initial length.
In some embodiments, the duration determination unit 502 is specifically configured to:
regarding to a test data packet in each test data packet, recording the sending time of the test data packet as a first time, and recording the receiving time of response data corresponding to the test data packet as a second time; and determining the difference value between the second time and the first time as the transmission duration of the test data packet.
In some embodiments, before sending test data packets with different lengths to the data sending party and receiving response data returned by the data sending party for each test data packet, the method further includes:
and sending a test instruction for controlling the data sending party to switch to the test state to the data sending party so as to enable the data sending party to switch to the test state.
In some embodiments, sending the determined maximum transmission packet length to the data sender, so that the data sender sends data to the data receiver based on the maximum transmission packet length, includes:
and sending a packet length instruction for controlling the data sending party to send data with the determined maximum transmission packet length to the data sending party, so that the data sending party sends the data to the data receiving party based on the maximum transmission packet length indicated by the packet length instruction.
In some embodiments, the response data corresponding to a test packet is a corresponding test packet.
The apparatus provided in this embodiment may determine, based on an actual data transmission situation between a data sender and a data receiver, a maximum transmission packet length suitable for data transmission between the data sender and the data receiver. Therefore, when the data required to be sent by the data sender is large, the data can be split by the maximum transmission packet length, so that the split data packets can be quickly transmitted to the data receiver, and the data transmission efficiency is improved.
It should be noted that, for the information interaction, execution process, and other contents between the above-mentioned devices/units, the specific functions and technical effects thereof are based on the same concept as those of the embodiment of the method of the present application, and specific reference may be made to the part of the embodiment of the method, which is not described herein again.
Referring further to fig. 6, fig. 6 is a schematic structural diagram of an electronic device 600 according to an embodiment of the present application. As shown in fig. 6, the electronic apparatus 600 of this embodiment includes: at least one processor 601 (only one processor is shown in fig. 6), a memory 602, and a computer program 603, such as a data transfer program, stored in the memory 602 and executable on the at least one processor 601. The steps in any of the various method embodiments described above are implemented when the computer program 603 is executed by the processor 601. The steps in the embodiments of the respective data transmission method described above are implemented when the processor 601 executes the computer program 603. The processor 601, when executing the computer program 603, implements the functions of the various modules/units in the various device embodiments described above, such as the functions of the units 501-503 shown in fig. 5.
Illustratively, the computer program 603 may be partitioned into one or more modules/units, which are stored in the memory 602 and executed by the processor 601 to accomplish the present application. One or more modules/units may be a series of computer program instruction segments capable of performing certain functions, the instruction segments describing the execution of the computer program 603 in the electronic device 600. For example, the computer program 603 may be divided into a data sending unit, a duration determining unit, and a packet length determining unit, where specific functions of the units are described in the foregoing embodiments, and are not described herein again.
The electronic device 600 may be a server, a desktop computer, a tablet computer, a cloud server, a mobile terminal, and other computing devices. The electronic device 600 may include, but is not limited to, a processor 601, a memory 602. Those skilled in the art will appreciate that fig. 6 is merely an example of an electronic device 600 and does not constitute a limitation of the electronic device 600 and may include more or fewer components than shown, or some components may be combined, or different components, e.g., the electronic device may also include input-output devices, network access devices, buses, etc.
The Processor 601 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic device, discrete hardware component, or the like. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The storage 602 may be an internal storage unit of the electronic device 600, such as a hard disk or a memory of the electronic device 600. The memory 602 may also be an external storage device of the electronic device 600, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like provided on the electronic device 600. Further, the memory 602 may also include both internal storage units and external storage devices of the electronic device 600. The memory 602 is used for storing computer programs and other programs and data required by the electronic device. The memory 602 may also be used to temporarily store data that has been output or is to be output.
It should be clear to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional units and modules is only used for illustration, and in practical applications, the above function distribution may be performed by different functional units and modules as needed, that is, the internal structure of the device is divided into different functional units or modules, so as to perform all or part of the above described functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. For the specific working processes of the units and modules in the system, reference may be made to the corresponding processes in the foregoing method embodiments, which are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
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 implementation. 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 application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/electronic device and method may be implemented in other ways. For example, the above-described apparatus/electronic device embodiments are merely illustrative, and for example, a module or a unit may be divided into only one logic function, and may be implemented in other ways, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one position, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated module, if implemented in the form of a software functional unit and sold or used as a separate product, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method according to the embodiments described above may be implemented by a computer program, which is stored in a computer readable storage medium and used by a processor to implement the steps of the embodiments of the methods described above. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer readable medium may include: any entity or device capable of carrying computer program code, recording medium, U.S. disk, removable hard disk, magnetic disk, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution media, and the like. It should be noted that the computer-readable medium may contain suitable additions or subtractions depending on the requirements of legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer-readable media may not include electrical carrier signals or telecommunication signals in accordance with legislation and patent practice.
The above embodiments are only used to illustrate the technical solutions of the present application, and not to limit the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.
Claims (10)
1. A method of data transmission, the method comprising:
in response to receiving a connection establishment request sent by a data sender, sending test data packets with different lengths to the data sender, and receiving response data returned by the data sender aiming at each test data packet;
determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet;
determining the length of the test data packet with the minimum corresponding transmission time length as the maximum transmission packet length, and sending the determined maximum transmission packet length to the data sending party, so that the data sending party sends data to the data receiving party based on the maximum transmission packet length.
2. The method according to claim 1, wherein the sending test packets with different lengths to the data sender and receiving response data returned by the data sender for each test packet comprises:
a data sending step: sending a test data packet with an initial length to the data sender, and receiving response data returned by the data sender aiming at the test data packet with the initial length;
and in response to the initial length being smaller than a preset length threshold, taking a sum of the initial length and a preset numerical value as a new initial length, and continuing to perform the data transmission step based on the new initial length.
3. The method of claim 1, wherein determining the transmission duration of each test packet according to the sending time of each test packet and the receiving time of the response data corresponding to the test packet comprises:
regarding to a test data packet in each test data packet, recording the sending time of the test data packet as a first time, and recording the receiving time of response data corresponding to the test data packet as a second time; and determining the difference value between the second time and the first time as the transmission duration of the test data packet.
4. The method according to claim 1, before said sending test packets with different lengths to said data sender and receiving response data returned by said data sender for each test packet, further comprising:
and sending a test instruction for controlling the data sending party to be switched to a test state to the data sending party so as to enable the data sending party to be switched to the test state.
5. The method of claim 1, wherein the sending the determined maximum transmission packet length to the data sender, so that the data sender sends data to a data receiver based on the maximum transmission packet length, comprises:
and sending a packet length instruction for controlling the data sending party to send data with the determined maximum transmission packet length to the data sending party, so that the data sending party sends data to the data receiving party based on the maximum transmission packet length indicated by the packet length instruction.
6. The method according to any of claims 1-5, wherein the response data corresponding to a test data packet is a corresponding test data packet.
7. A data transmission system, characterized in that the system comprises a data sender and a data receiver, wherein,
the data sender is used for sending a connection establishment request to the data receiver;
the data receiving party is used for responding to a connection establishment request sent by the data sending party, sending test data packets with different lengths to the data sending party and receiving response data returned by the data sending party aiming at each test data packet; determining the transmission duration of the corresponding test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet; determining the length of the test data packet with the minimum corresponding transmission time length as the maximum transmission packet length, and sending the determined maximum transmission packet length to the data sending party;
and the data sender is used for sending data to the data receiver based on the maximum transmission packet length.
8. A data transmission apparatus, characterized in that the apparatus comprises:
the data sending unit is used for responding to a connection establishment request sent by a data sending party, sending test data packets with different lengths to the data sending party and receiving response data returned by the data sending party aiming at each test data packet;
a time length determining unit, configured to determine a transmission time length of each test data packet according to the sending time of each test data packet and the receiving time of the response data corresponding to the test data packet;
a packet length determining unit, configured to determine a length of a test data packet corresponding to a minimum transmission duration as a maximum transmission packet length, and send the determined maximum transmission packet length to the data sending side, so that the data sending side sends data to a data receiving side based on the maximum transmission packet length.
9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method of any of claims 1 to 6 when executing the computer program.
10. A computer-readable storage medium, in which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1 to 6.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011279089.1A CN112566082B (en) | 2020-11-16 | 2020-11-16 | Data transmission method, device, equipment and medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202011279089.1A CN112566082B (en) | 2020-11-16 | 2020-11-16 | Data transmission method, device, equipment and medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN112566082A CN112566082A (en) | 2021-03-26 |
CN112566082B true CN112566082B (en) | 2023-01-24 |
Family
ID=75042449
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202011279089.1A Active CN112566082B (en) | 2020-11-16 | 2020-11-16 | Data transmission method, device, equipment and medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112566082B (en) |
Family Cites Families (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7697524B2 (en) * | 2005-04-05 | 2010-04-13 | Cisco Technology, Inc. | Method and system for determining path maximum transfer unit for IP multicast |
CN102088410A (en) * | 2011-01-25 | 2011-06-08 | 中国人民解放军国防科学技术大学 | Method and system for message fragmentation |
CN102780621B (en) * | 2012-07-23 | 2015-08-19 | 北京星网锐捷网络技术有限公司 | A kind of upstream data packet transmission method, device and the network equipment |
CN106105310B (en) * | 2014-03-12 | 2019-09-17 | Lg 电子株式会社 | The method and apparatus of message transmission rate is adjusted in wireless communication system |
CN111065084A (en) * | 2020-02-25 | 2020-04-24 | 北京百瑞互联技术有限公司 | Method for improving low-power-consumption Bluetooth transmission speed |
-
2020
- 2020-11-16 CN CN202011279089.1A patent/CN112566082B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN112566082A (en) | 2021-03-26 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7562661B2 (en) | Software upgrade method, apparatus and system | |
CN113852563B (en) | Message data transmission method and device, terminal equipment and readable storage medium | |
CN108563518A (en) | Master-slave machine communication method, device, terminal equipment and storage medium | |
CN110392381B (en) | Multi-channel wireless communication method and device for nuclear power station and terminal equipment | |
CN111338662A (en) | Firmware upgrading method and device for slave station and terminal | |
CN110912805B (en) | Message reading state synchronization method, terminal, server and system | |
CN112235370B (en) | Equipment information synchronization method, synchronization device, main equipment and storage medium | |
CN113157625A (en) | Data transmission method and device, terminal equipment and computer readable storage medium | |
CN112422485B (en) | Communication method and device of transmission control protocol | |
CN112630557A (en) | Equipment state detection method, device, equipment and medium | |
CN113489653A (en) | Message sending method and device and computer equipment | |
CN110662191B (en) | Communication mode selection method and device and electronic equipment | |
CN112566082B (en) | Data transmission method, device, equipment and medium | |
CN112667270A (en) | Voice processing resource updating method, computer equipment and storage device | |
CN110597643B (en) | Inter-core communication method, processor and electronic equipment | |
CN110177035B (en) | Data receiving and sending method, device and data receiving and sending system | |
CN110035399B (en) | Message transmission method and related equipment | |
CN115695077A (en) | Bus data receiving method and device, electronic equipment and storage medium | |
CN112203338B (en) | Networking method and device for wireless terminal | |
CN113395264A (en) | Communication connection method, apparatus, server and medium | |
CN112068414B (en) | Multi-system timing method, device, equipment and medium | |
CN116533817A (en) | Charging remaining time prediction method, device and storage medium | |
CN114326673A (en) | Vehicle remote diagnosis method and device, connector and storage medium | |
CN110876852A (en) | Network game data processing method and system of micro-service | |
CN112203264B (en) | Equipment pairing method applied to equipment group and equipment in equipment group |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |