WO2023123991A1 - Data transmission method and apparatus, electronic device, and storage medium - Google Patents

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

Info

Publication number
WO2023123991A1
WO2023123991A1 PCT/CN2022/103672 CN2022103672W WO2023123991A1 WO 2023123991 A1 WO2023123991 A1 WO 2023123991A1 CN 2022103672 W CN2022103672 W CN 2022103672W WO 2023123991 A1 WO2023123991 A1 WO 2023123991A1
Authority
WO
WIPO (PCT)
Prior art keywords
terminal
data
data transmission
compression
message
Prior art date
Application number
PCT/CN2022/103672
Other languages
French (fr)
Chinese (zh)
Inventor
周朝四
Original Assignee
深圳市广和通无线股份有限公司
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 深圳市广和通无线股份有限公司 filed Critical 深圳市广和通无线股份有限公司
Publication of WO2023123991A1 publication Critical patent/WO2023123991A1/en

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/04Protocols for data compression, e.g. ROHC
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]

Definitions

  • the present application relates to the technical field of data communication, and in particular to a data transmission method, device, electronic equipment and storage medium.
  • the present application provides a data transmission method applied to a first terminal, and the method includes:
  • the compression identifier interact with the second terminal on the data transmission message, the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the first terminal and the second terminal.
  • the present application provides a data transmission method, which is applied to a second terminal, and the method includes:
  • the data transmission message is interacted with the first terminal.
  • the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the first terminal and the second terminal.
  • the present application provides a data transmission device, which is applied to a first terminal, and the device includes:
  • the first sending module is configured to send a request message to the second terminal, where the request message carries a compression identifier
  • the first receiving module is configured to receive a response message fed back by the second terminal based on the request message, where the response message is used to indicate that the second terminal has received the compressed identifier;
  • the first data interaction module is configured to interact with the second terminal on the data transmission message according to the compression identifier, the data transmission message carries compressed data, and the compressed data is performed on the original data by any one of the first terminal and the second terminal get compressed.
  • the present application provides a data transmission device, which is applied to a second terminal, and the device includes:
  • the second receiving module is configured to receive a request message sent by the first terminal, where the request message carries a compression identifier
  • the second sending module is configured to feed back a response message to the first terminal based on the request message, and the response message is used to indicate that the second terminal has received the compressed identifier;
  • the second data interaction module is configured to interact with the first terminal on the data transmission message according to the compression identifier.
  • the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by the first terminal or the second terminal.
  • the present application provides an electronic device, including a memory and one or more processors, the memory stores computer-readable instructions, and the one or more processors execute the computer-readable instructions to implement the steps of the above method.
  • the present application provides a computer-readable storage medium, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by one or more processors, the steps of the above method are implemented.
  • the present application provides a computer program product, including computer readable instructions, which implement the steps of the above method when executed by one or more processors.
  • Fig. 1 is a schematic diagram of an application environment of a data transmission method in an embodiment
  • Fig. 2 is a schematic flow chart of a data transmission method in an embodiment
  • Fig. 3 is a schematic diagram of the packet format of the connection request of the MQTT protocol in an embodiment
  • Fig. 4 is a schematic diagram of the communication flow of the MQTT protocol in an embodiment
  • FIG. 5 is a schematic flow diagram of a data transmission method in another embodiment
  • Fig. 6 is a schematic flow chart of a data transmission method in another embodiment
  • FIG. 7 is a schematic structural diagram of a data transmission device in an embodiment
  • FIG. 8 is a schematic structural diagram of a data transmission device in an embodiment
  • Fig. 9 is a schematic diagram of the internal structure of an electronic device in one embodiment.
  • FIG. 1 is a schematic diagram of an application environment of a data transmission method in an embodiment.
  • the data transmission method provided in the embodiment of the present application may be applied in the application environment shown in FIG. 1 .
  • the first terminal 110 and the second terminal 120 perform data transmission through a specific communication protocol.
  • the first terminal 110 and the second terminal 120 are transmitted through MQTT (Message Queuing Telemetry Transport) protocol.
  • MQTT is a client-server based message publish/subscribe transport protocol.
  • the MQTT protocol is lightweight, simple, open and easy to implement. These characteristics make it widely applicable. In many cases, including constrained environments such as machine-to-machine (M2M) communication and the Internet of Things (IoT). It is used extensively in sensors communicating via satellite links, medical devices that occasionally dial, smart homes, and some miniaturized devices.
  • M2M machine-to-machine
  • IoT Internet of Things
  • the party that sends the data from the first terminal 110 and the second terminal 120 fills the data into the PUBLISH (release) message and sends it.
  • the publish message A message may be an implementation of a data transmission message.
  • the PUBLISH message filled with data is sent to the party receiving the data from the first terminal 110 and the second terminal 120 .
  • the first terminal 110 and the second terminal 120 are connected through the MQTT protocol, the first terminal 110 may be regarded as a device end, and the second terminal 120 may be regarded as a server end.
  • the first terminal 110 and the second terminal 120 can be, but not limited to, personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners , Smart vehicle equipment, etc.
  • Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, and the like.
  • FIG. 2 is a schematic flowchart of a data transmission method in an embodiment.
  • a data transmission method is provided. The method is applied to the first terminal in FIG. 1 as an example for illustration, including steps 210 to 230 .
  • Step 210 Send a request message to the second terminal, where the request message carries a compression identifier.
  • the request message is sent by the first terminal to the second terminal.
  • the compression identifier refers to the identifier carried in the request message, and the compression identifier is used to indicate that the subsequent data transmission messages that the second terminal interacts with the first terminal carry compressed data.
  • the data transfer message may be a publication message.
  • Step 220 Receive a response message fed back by the second terminal based on the request message, where the response message is used to indicate that the second terminal has received the compressed identifier.
  • the response message refers to that generated by the second terminal based on the request message.
  • the first terminal receives the response message fed back by the second terminal based on the request message, and the response message is used to indicate that the second terminal has received the compressed identifier, so that the first terminal can ensure that the second terminal receives to the compression flag, and then interact with the compressed data.
  • Step 230 According to the compression identifier, interact with the second terminal on the data transmission message, the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the first terminal and the second terminal .
  • the interaction between the first terminal and the second terminal for data transmission messages may be that the first terminal sends a data transmission message to the second terminal, or that the first terminal receives a data transmission message sent by the second terminal.
  • the message is determined by the result of interaction with the actual message, which is not limited in this embodiment. Specifically, if the first terminal sends a data transmission message to the second terminal, the compressed data is obtained by compressing the original data by the first terminal; if the first terminal receives the data transmission message sent by the second terminal. Then the compressed data is obtained by compressing the original data by the second terminal.
  • the data transmission message carries compressed data, so the data size of the data transmission message is lower.
  • the data carried in the data transmission message is all compressed data, and The data size of the compressed data must be lower. Therefore, even if the network resources are seriously occupied or the network bandwidth is low, the data can be transmitted in a timely manner, avoiding the problem of excessive data transmission delay. , realizing the technical effect of improving the real-time performance of data transmission.
  • the subsequent data exchange between the first terminal and the second terminal is a data transmission message carrying compressed data, that is, sending a request message once can realize the communication between the first terminal and the second terminal.
  • the second terminals all perform the exchange of compressed data, and do not need to send a request message every time the compressed data is compressed, which improves the efficiency and simplicity of compressed data transmission.
  • the data transmission message includes at least one of a first data transmission message and a second data transmission message
  • the first data transmission message is a data transmission message sent by the first terminal to the second terminal.
  • the second data transmission message is a data transmission message sent by the second terminal to the first terminal, and the data transmission message interaction with the second terminal includes:
  • the first terminal compresses the first original data to obtain the first compressed data, and fills the first compressed data into the first data transmission message, and sending the filled first data transmission message to the second terminal;
  • the first terminal acquires the second compressed data carried in the second data transmission message, and decompresses the second compressed data to obtain the second original data .
  • the first data transmission packet carries the first compressed data.
  • the second data transmission message carries the second compressed data. Specifically, it may be only the first compressed data sent by the first terminal to the second terminal, or it may be the second compressed data sent by the second terminal to the first terminal.
  • the first compressed data refers to data obtained after the first terminal compresses the first original data.
  • the first original data refers to data that needs to be sent but has not been compressed.
  • the second compressed data refers to data obtained after the second terminal compresses the second original data.
  • the second original data refers to data that needs to be sent but has not been compressed.
  • the first terminal when the first terminal sends the first data transmission message to the second terminal, the first terminal compresses the first original data to obtain the first compressed data, and fills the first compressed data into the second A data transmission message, so that the first data transmission message carrying the first compressed data is sent to the second terminal.
  • the first terminal receives the second data transmission message sent by the second terminal, the first terminal extracts the second compressed data from the second data transmission message, and decompresses the second compressed data to obtain the second original data.
  • the first terminal and the second terminal confirm the latest request message each time they send data or receive data, and if the latest request message carries a compression identifier, perform a decompression operation.
  • sending the request message to the second terminal includes:
  • the first terminal confirms whether a preset condition for exchanging compressed data with the second terminal is met
  • the request message is sent to the second terminal.
  • the first terminal confirms whether the preset condition for exchanging compressed data with the second terminal is met, and if so, compresses the exchanged data, thereby sending a request message to the second terminal, so that the first terminal The data that is subsequently interacted with the second terminal is compressed data, thereby improving the timeliness of data transmission.
  • meeting the preset conditions includes at least one of the following:
  • the first terminal responds to the setting operation of setting the compressed data by the user
  • the first terminal transmits data through the SIM card.
  • the user sets the first terminal to the compressed data mode, and the first terminal sends a request message to the second terminal in response to the user's setting operation of setting the compressed data.
  • the first terminal may transmit data to the second terminal through a WiFi network or a SIM card.
  • the first terminal transmits data through the SIM card, since the usage traffic of the SIM card is limited, when the first terminal prepares to transmit data through the SIM card, it sends a request message to the second terminal, and the subsequent The data transmitted through the SIM card is compressed data, which can reduce the traffic consumption of the SIM card.
  • the first terminal and the second terminal perform data interaction through the MQTT protocol.
  • the request message is a connection request message sent when the first terminal establishes a connection with the second terminal.
  • the compression identifier is configured in the connection flag field of the connection request.
  • the response packet is a connection response packet.
  • the request message is a connection request message sent when the first terminal establishes a connection with the second terminal, which is equivalent to that the first terminal sends the compressed identifier to the second terminal during the process of establishing the connection with the second terminal. Then, after the connection between the first terminal and the second terminal is established, the data exchanged are all compressed data.
  • FIG. 3 is a schematic diagram of a data packet format of a connection request of the MQTT protocol in an embodiment.
  • the compression flag is configured in the connection flag field (Connect Flags) of the connection request.
  • the connection flag field does not have a substantial effect in the connection request
  • this embodiment uses the connection flag of the multiplex connection request field, there is no need to change the data packet format of the request message, only need to configure the compression field in the connection flag field, which reduces the complexity of sending the request message to the second terminal.
  • the compression flag can be "0" or "1". Exemplarily, if the compression flag is "1", then the value of the connection flag field is 0, which means no compression, and the value of the connection flag field, which is 1, means compression.
  • FIG. 4 is a schematic diagram of a communication flow of the MQTT protocol in an embodiment.
  • the first terminal sends a request message to the second terminal
  • one of the first terminal and the second terminal that sends the PUBLISH message needs to compress the data before sending the PUBLISH message
  • the party receiving the PUBLISH message needs to obtain the compressed data from the received PUBLISH message, and then decompress the compressed data.
  • performing compression processing on the first original data to obtain the first compressed data includes:
  • the first original data is compressed by a preset compression algorithm to obtain the first compressed data.
  • the preset compression algorithm may be a pre-configured compression algorithm.
  • the first original data to be transmitted needs to be compressed, the first original data is compressed by using a preset compression algorithm.
  • the first terminal compresses the first original data by using a fixed preset compression algorithm.
  • the preset compression algorithm may be an LZMA compression algorithm.
  • Advantages of LZMA compression algorithm high compression ratio; small decompression code: about 5KB; only a small amount of memory is needed for decompression (depending on the dictionary size); the dictionary size can be changed (up to 4GB); compression speed: processing in a 2GHz Running on a server, it can reach a speed of about 1MB per second; decompression speed: running on a 2GHz processor, it can reach a speed of about 10-20MB per second; supports multi-threading, multi-core (multi-processor) and Hyper-Threading of the Pentium 4 processor; the above characteristics make the LZMA algorithm very suitable for embedded system applications.
  • decompressing the second compressed data to obtain the second original data includes:
  • the second original data is obtained by decompressing the second compressed data through a preset decompression algorithm.
  • the preset decompression algorithm may be a pre-configured decompression algorithm.
  • the number of preset decompression algorithms is the same as the number of preset compression algorithms.
  • the second compressed data is compressed by using a preset decompression algorithm.
  • the first terminal decompresses the second compressed data by using a fixed preset decompression algorithm.
  • the preset decompression algorithm may be an LZMA decompression algorithm.
  • the request message also carries a compression algorithm identifier, and the preset compression algorithm is called, and the first original data is compressed by the preset compression algorithm to obtain the first compressed data, include:
  • the first terminal invokes a target compression algorithm corresponding to the compression algorithm identifier, where the target compression algorithm is one of multiple preset compression algorithms;
  • the first original data is compressed by the target compression algorithm to obtain the first compressed data.
  • the compression algorithm identifier is used to indicate which preset compression algorithm among multiple preset compression algorithms is used for data compression.
  • the multiple preset compression algorithms include but are not limited to at least two of LZMA compression algorithm, LZ4 compression algorithm, Huffman compression algorithm, run-length coding algorithm, and the like.
  • the first terminal sends the request message carrying the compression algorithm identifier to the second terminal, and after receiving the response message, the party that sends data between the first terminal and the second terminal first queries the latest request message file, so that the data is compressed through the target compression algorithm corresponding to the target compression algorithm identifier; wherein, the target compression algorithm identifier is the compression algorithm identifier in the latest request message.
  • the compression algorithm identifier is determined according to the data type of the data to be interacted with.
  • the data type is used to represent the type of the first original data.
  • the data type includes but not limited to video data and voice data.
  • the compression algorithm identifier is obtained according to the data type of the first original data.
  • the compression algorithm identifier corresponds to the data type of the first original data. Exemplarily, assuming that multiple preset compression algorithms include the LZMA compression algorithm and the LZ4 compression algorithm, then in fields other than the field where the compression identifier is located, "0" indicates the LZMA compression algorithm, and "1" indicates the LZ4 compression algorithm.
  • a compression algorithm with a higher compression rate can be used to compress, so as to reduce the data volume of video data as much as possible;
  • voice data its data volume Smaller, so the compression algorithm with high compression speed can be used to complete the compression as fast as possible, thereby increasing the compression rate of voice data and further improving the real-time performance of data transmission.
  • the request message also carries a decompression algorithm identifier, and the preset decompression algorithm is called, and the second compressed data is decompressed by the preset decompression algorithm to obtain the second compressed data.
  • Raw data including:
  • the first terminal invokes a target decompression algorithm corresponding to the decompression algorithm identifier, where the target decompression algorithm is one of multiple preset decompression algorithms;
  • the second compressed data is decompressed by the target decompression algorithm to obtain the second original data.
  • the decompression algorithm identifier is also used to indicate which preset decompression algorithm among the multiple preset decompression algorithms performs data decompression.
  • the multiple preset decompression algorithms include but are not limited to at least two of LZMA decompression algorithm, LZ4 decompression algorithm, Huffman decompression algorithm, run-length decoding algorithm, and the like.
  • the decompression algorithm identifier is determined according to the data type of the data to be interacted with, and corresponds to the compression algorithm identifier.
  • the party receiving the data from the first terminal and the second terminal first queries the latest request message, so as to pass the target decompression algorithm
  • the corresponding target decompression algorithm is identified to decompress the data, wherein the target decompression algorithm identification is the decompression algorithm identification in the latest request message.
  • the first terminal when sending the request message to the second terminal, the first terminal sends the compression algorithm identifier and the decompression algorithm identifier to the second terminal together.
  • the party that sends data between the first terminal and the second terminal compresses the transmitted data by using a target compression algorithm corresponding to the compression algorithm identifier.
  • the first terminal and the second terminal receiving the data decompress the compressed data by using the target decompression algorithm identified by the decompression algorithm to restore the data.
  • the first terminal identifies the data type of the first original data, and obtains the decompression algorithm identification and compression algorithm identification corresponding to the data type, so as to fill the decompression algorithm identification and compression algorithm identification into the request message, so as to carry the The decompression algorithm identification and the request message of the compression algorithm identification are sent to the second terminal.
  • the compression algorithm identifier and the decompression algorithm identifier are sent to the second terminal together, and the compression algorithm identifier and the decompression algorithm identifier are based on The data type of the interactive data is determined, so different algorithms may be used for decompression processing according to the data type of the first original data.
  • the compression algorithm and the decompression algorithm are corresponding, so the decompression algorithm identification and the compression algorithm identification are an algorithm identification, and the corresponding target compression algorithm or target decompression algorithm can be determined through an algorithm identification.
  • the decompression algorithm identification and the compression algorithm identification as an algorithm identification, when changing the data packet format of the request message, the complexity of changing the data packet format can be reduced, and the number of acquisition target compression algorithms or target decompression algorithms can be reduced. The complexity of the algorithm.
  • FIG. 5 is a schematic flowchart of a data transmission method in another embodiment.
  • a data transmission method is provided, which is described by taking the method applied to the second terminal in FIG. 1 as an example, including steps 510 to 530 .
  • Step 510 Receive a request message sent by the first terminal, where the request message carries a compression identifier.
  • Step 520 Feedback a response message to the first terminal based on the request message, where the feedback response message is used to indicate that the second terminal has received the compression identifier.
  • Step 530 According to the compression identifier, interact with the first terminal in the data transmission message, the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the second terminals in the first terminal.
  • the data carried in the data transmission message is all compressed data, and The data size of the compressed data must be lower. Therefore, even if the network resources are seriously occupied or the network bandwidth is low, the data can be transmitted in a timely manner, avoiding the problem of excessive data transmission delay. , realizing the technical effect of improving the real-time performance of data transmission.
  • the subsequent data exchange between the first terminal and the second terminal is a data transmission message carrying compressed data, that is, sending a request message once can realize the communication between the first terminal and the second terminal.
  • the second terminals all perform the exchange of compressed data, and do not need to send a request message every time the compressed data is compressed, which improves the efficiency and simplicity of compressed data transmission.
  • the data transmission message includes at least one of a first data transmission message and a second data transmission message
  • the first data transmission message is a data transmission message sent by the first terminal to the second terminal.
  • the second data transmission message is a data transmission message sent by the second terminal to the first terminal, and the data transmission message interaction with the second terminal includes:
  • the second terminal In the case of receiving the first data transmission message sent by the first terminal, the second terminal obtains the first compressed data carried in the first data transmission message, and decompresses the first compressed data to obtain the first original data;
  • the second terminal compresses the second original data to obtain the second compressed data, and fills the second compressed data into the second data transmission message, and the sending the filled second data transmission message to the first terminal;
  • the step of the second terminal compressing the second original data to be transmitted to obtain the second compressed data includes:
  • the second original data is compressed by a preset compression algorithm to obtain second compressed data.
  • the second terminal invokes the preset compression algorithm to compress the second original data through the preset compression algorithm to obtain the second compressed data, including:
  • the second terminal invokes a target compression algorithm corresponding to the compression algorithm identifier, where the target compression algorithm is one of multiple preset compression algorithms;
  • the second original data is compressed by using a target compression algorithm to obtain second compressed data.
  • the second terminal decompresses the first compressed data to obtain the first original data, including:
  • the second terminal invokes a preset decompression algorithm
  • the first original data is obtained by decompressing the first compressed data through a preset decompression algorithm.
  • the second terminal invokes the preset decompression algorithm, and decompresses the first compressed data through the preset decompression algorithm to obtain the first original data, including:
  • the second terminal invokes a target decompression algorithm corresponding to the decompression algorithm identifier, where the target decompression algorithm is one of multiple preset decompression algorithms;
  • FIG. 6 is a schematic flowchart of a data transmission method in another embodiment.
  • a data transmission method is provided, and the method is applied to the first terminal and the second terminal in FIG. 1 as an example for illustration.
  • the data transmission method in this embodiment includes step 610 to step 650 .
  • Step 610 the first terminal sends a request message to the second terminal, and the request message carries a compression identifier.
  • the first terminal may send the compression identifier to the second terminal during the process of establishing a connection with the second terminal, and after the connection is established, both the first terminal and the second terminal Interact with compressed data.
  • the first terminal may send the connection request message to the second terminal as a request message.
  • Step 620 the second terminal receives the request message sent by the first terminal.
  • Step 630 the second terminal responds to the request message, generates a response message, and feeds back the response message to the first terminal.
  • Step 640 the first terminal receives the response message fed back by the second terminal.
  • the first terminal may consider that the second terminal has received the compression identifier, and may subsequently interact with compressed data.
  • Step 650 the first terminal and the second terminal perform data transmission message interaction according to the compression identifier, and the data transmission message carries compressed data.
  • the data carried in the data transmission message is all compressed data, and The data size of the compressed data must be lower. Therefore, even if the network resources are seriously occupied or the network bandwidth is low, the data can be transmitted in a timely manner, avoiding the problem of excessive data transmission delay. , realizing the technical effect of improving the real-time performance of data transmission.
  • the subsequent data exchange between the first terminal and the second terminal is a data transmission message carrying compressed data, that is, sending a request message once can realize the communication between the first terminal and the second terminal.
  • the second terminals all perform the exchange of compressed data, and do not need to send a request message every time the compressed data is compressed, which improves the efficiency and simplicity of compressed data transmission.
  • steps in the flow charts involved in the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flow charts involved in the above embodiments may include multiple steps or stages, and these steps or stages are not necessarily executed at the same time, but may be executed at different times, The execution order of these steps or stages is not necessarily performed sequentially, but may be executed in turn or alternately with other steps or at least a part of steps or stages in other steps.
  • an embodiment of the present application further provides a data transmission device for implementing the above-mentioned data transmission method.
  • the solution to the problem provided by the device is similar to the implementation described in the above method, so the specific limitations in one or more embodiments of the data transmission device provided below can refer to the definition of the data transmission method above, in This will not be repeated here.
  • FIG. 7 is a schematic structural diagram of a data transmission device in an embodiment.
  • a data transmission device is provided.
  • the device is applied to the first terminal in FIG. 1 as an example, including a first sending module 710, a first receiving module 720 and The first data interaction module 730, wherein:
  • the first sending module 710 is configured to send a request message to the second terminal, and the request message carries a compression identifier;
  • the first receiving module 720 is configured to receive a response message fed back by the second terminal based on the request message, and the response message It is used to indicate that the second terminal has received the compressed identifier;
  • the first data interaction module 730 is configured to interact with the second terminal on the data transmission message according to the compressed identifier, the data transmission message carries compressed data, and the compressed data is sent by the first The terminal or the second terminal compresses the original data to obtain it.
  • the first sending module 710 is specifically configured to confirm whether a preset condition for exchanging compressed data with the second terminal is met; if the preset condition is met, send a request message to the second terminal.
  • meeting the preset conditions includes at least one of the following:
  • the first terminal responds to the setting operation of setting the compressed data by the user; the first terminal transmits the data through the SIM card.
  • the compression identifier is configured in the connection flag field of the connection request message.
  • the data transmission message includes at least one of a first data transmission message and a second data transmission message
  • the first data transmission message is a data transmission message sent by the first terminal to the second terminal
  • the second data transmission message is a data transmission message sent by the second terminal to the first terminal
  • the first data interaction module 730 is specifically used for:
  • the first data interaction module 730 includes:
  • a first compression algorithm calling unit configured to call a preset compression algorithm
  • the first compression unit is configured to compress the first original data through a preset compression algorithm to obtain first compressed data.
  • the request message also carries a compression algorithm identifier, which is determined according to the data type of the interactive data, and the first compression unit is specifically used to call and compress the algorithm A corresponding target compression algorithm is identified, and the target compression algorithm is one of a plurality of preset compression algorithms; the first original data is compressed by the target compression algorithm to obtain the first compressed data.
  • the first data interaction module 730 includes:
  • the first decompression algorithm calling unit is used to call the preset decompression algorithm
  • the first decompression unit is configured to decompress the second compressed data through a preset decompression algorithm to obtain second original data.
  • the request message also carries a decompression identifier
  • the first decompression unit is specifically used to call a target decompression algorithm corresponding to the decompression algorithm identifier
  • the target decompression algorithm is multiple preset One of the decompression algorithms; decompressing the second compressed data through the target decompression algorithm to obtain the second original data.
  • FIG. 8 is a schematic structural diagram of a data transmission device in an embodiment.
  • a data transmission device is provided.
  • the device is applied to the second terminal in FIG. 1 as an example for illustration, including a second receiving module 810, a second sending module 820 and The second data interaction module 830, wherein:
  • the second receiving module 810 is configured to receive a request message sent by the first terminal, and the request message carries a compression identifier; the second sending module 820 is configured to feed back a response message to the first terminal based on the request message, and feed back the response message The text is used to indicate that the second terminal has received the compressed identifier; the second data interaction module 830 is configured to interact with the first terminal on the data transmission message according to the compressed identifier, the data transmission message carries compressed data, and the compressed data is sent by the first terminal The first terminal or the second terminal compresses the original data.
  • the second data interaction module 830 includes: a second compression algorithm calling unit, configured to call a preset compression algorithm; a second compression unit, configured to compress the second original data through the preset compression algorithm to obtain the first Two compressed data.
  • the second compression algorithm unit is specifically used to call a target compression algorithm corresponding to the compression algorithm identifier, and the target compression algorithm is one of multiple preset compression algorithms;
  • the algorithm compresses the second original data to obtain the second compressed data.
  • the second data interaction module 830 includes: a second decompression algorithm calling unit, configured to call a preset decompression algorithm; a second decompression unit, configured to decompress the first compressed data through the preset decompression algorithm to obtain first raw data.
  • the second decompression unit is specifically used to call the target decompression algorithm corresponding to the decompression algorithm identification, and the target decompression algorithm is one of the multiple preset decompression algorithms; through the target decompression algorithm Decompressing the first compressed data to obtain the first original data.
  • Each module in the above-mentioned data transmission device may be fully or partially realized by software, hardware and a combination thereof.
  • the above-mentioned modules can be embedded in or independent of one or more processors in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that one or more processors can call and execute the above The operation corresponding to the module.
  • an electronic device including a memory and one or more processors, computer-readable instructions are stored in the memory, and the above-mentioned methods are implemented when the one or more processors execute the computer-readable instructions steps in the example.
  • FIG. 9 is a schematic diagram of an internal structure of an electronic device in an embodiment.
  • the electronic device includes one or more processors, memory, communication interface, display screen and input device connected through a system bus.
  • the processor of the electronic device is used to provide calculation and control capabilities.
  • the memory of the electronic device includes a non-volatile storage medium and an internal memory.
  • the non-volatile storage medium stores an operating system and computer readable instructions.
  • the internal memory provides an environment for the execution of the operating system and computer readable instructions in the non-volatile storage medium.
  • the communication interface of the electronic device is used for wired or wireless communication with external electronic devices, and the wireless method can be realized through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies.
  • the computer readable instructions implement a data transmission method when executed by one or more processors.
  • the display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen
  • the input device of the electronic device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the housing of the electronic device , and can also be an external keyboard, touchpad, or mouse.
  • both the first terminal and the second terminal in this embodiment are electronic devices.
  • FIG. 9 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation on the electronic equipment to which the solution of this application is applied.
  • the specific electronic equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
  • the electronic device can be a wireless communication module, or a smart device including a wireless communication module (such as a smart car, a smart cabinet, a smart meter, etc.), or a communication device such as a mobile phone, a computer, or a tablet. .
  • a wireless communication module such as a smart car, a smart cabinet, a smart meter, etc.
  • a communication device such as a mobile phone, a computer, or a tablet.
  • a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by one or more processors, the steps in the foregoing method embodiments are implemented.
  • a data transmission system including a first terminal and a second terminal.
  • first terminal and second terminal For the steps performed by the first terminal and the second terminal, reference may be made to the description of any of the foregoing embodiments, and details are not described in this embodiment.
  • a computer program product including computer readable instructions, which implement the steps of the above method when executed by one or more processors.
  • any reference to storage, database or other media used in the various embodiments provided in the present application may include at least one of non-volatile and volatile storage.
  • Non-volatile memory can include read-only memory (Read-Only Memory, ROM), tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive variable memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory, MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (Phase Change Memory, PCM), graphene memory, etc.
  • the volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory, etc.
  • RAM Random Access Memory
  • RAM Random Access Memory
  • RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM).
  • the databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database.
  • the non-relational database may include a blockchain-based distributed database, etc., but is not limited thereto.
  • the processors involved in the various embodiments provided by this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, compressed data processing logic devices based on quantum computing, etc. limited to this.

Abstract

A data transmission method. The method comprises: sending a request message to a second terminal, the request message carrying a compression identifier (step 210); receiving a response message returned by the second terminal on the basis of the request message, the response message being used for indicating that the second terminal received the compression identifier (step 220); and performing data transmission message interaction with the second terminal according to the compression identifier, the data transmission message carrying compressed data, and the compressed data being obtained by any one among a first terminal and the second terminal compressing original data (step 230).

Description

数据传输方法、装置、电子设备和存储介质Data transmission method, device, electronic device and storage medium
本申请要求于2021年12月29日提交中国专利局,申请号为202111641236.X、发明名称为“数据传输方法、装置、电子设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application with the application number 202111641236.X and the title of the invention "data transmission method, device, electronic equipment and storage medium" submitted to the China Patent Office on December 29, 2021, the entire content of which is passed References are incorporated in this application.
技术领域technical field
本申请涉及数据通信技术领域,特别是涉及一种数据传输方法、装置、电子设备和存储介质。The present application relates to the technical field of data communication, and in particular to a data transmission method, device, electronic equipment and storage medium.
背景技术Background technique
随着数据通信技术的发展,如何保证提高数据传输的实时性也越来越重要。With the development of data communication technology, how to ensure the real-time performance of data transmission is becoming more and more important.
目前,不同终端之间的进行数据的传输时,都是通过完整的数据通过特定的通信协议进行传输的。然而,在网络资源占用比较严重,或者是网络带宽较低的情况下,容易存在数据传输延时过高的问题。At present, when data is transmitted between different terminals, complete data is transmitted through a specific communication protocol. However, when the network resources are seriously occupied or the network bandwidth is low, the problem of high data transmission delay is likely to exist.
发明内容Contents of the invention
基于此,有必要针对上述技术问题,提供一种能够提高数据传输的实时性的数据传输方法、装置、电子设备和存储介质。Based on this, it is necessary to provide a data transmission method, device, electronic device and storage medium capable of improving the real-time performance of data transmission for the above technical problems.
第一方面,本申请提供了一种数据传输方法,应用于第一终端,方法包括:In a first aspect, the present application provides a data transmission method applied to a first terminal, and the method includes:
向第二终端发送请求报文,请求报文携带有压缩标识;Send a request message to the second terminal, where the request message carries a compression identifier;
接收第二终端基于请求报文反馈的响应报文,响应报文用于表示第二终端接收到压缩标识;receiving a response message fed back by the second terminal based on the request message, where the response message is used to indicate that the second terminal has received the compression identifier;
根据压缩标识,与第二终端进行数据传输报文的交互,数据传输报文携带有压缩数据,压缩数据由所述第一终端和第二终端中任意一个对原始数据进行压缩得到。According to the compression identifier, interact with the second terminal on the data transmission message, the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the first terminal and the second terminal.
第二方面,本申请提供了一种数据传输方法,应用于第二终端,方法包括:In a second aspect, the present application provides a data transmission method, which is applied to a second terminal, and the method includes:
接收第一终端发送的请求报文,请求报文携带有压缩标识;receiving a request message sent by the first terminal, where the request message carries a compression identifier;
基于请求报文向第一终端反馈响应报文,响应报文用于表示第二终端接收到压缩标识;Feedback a response message to the first terminal based on the request message, where the response message is used to indicate that the second terminal has received the compressed identifier;
根据压缩标识,与第一终端进行数据传输报文的交互,数据传输报文携带有压缩数据,压缩数据由第一终端和第二终端中任意一个对原始数据进行压缩得到。According to the compression identifier, the data transmission message is interacted with the first terminal. The data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the first terminal and the second terminal.
第三方面,本申请提供了一种数据传输装置,应用于第一终端, 装置包括:In a third aspect, the present application provides a data transmission device, which is applied to a first terminal, and the device includes:
第一发送模块,用于向第二终端发送请求报文,请求报文携带有压缩标识;The first sending module is configured to send a request message to the second terminal, where the request message carries a compression identifier;
第一接收模块,用于接收第二终端基于请求报文反馈的响应报文,响应报文用于表示第二终端接收到压缩标识;The first receiving module is configured to receive a response message fed back by the second terminal based on the request message, where the response message is used to indicate that the second terminal has received the compressed identifier;
第一数据交互模块,用于根据压缩标识,与第二终端进行数据传输报文的交互,数据传输报文携带有压缩数据,压缩数据由第一终端和第二终端中任意一个对原始数据进行压缩得到。The first data interaction module is configured to interact with the second terminal on the data transmission message according to the compression identifier, the data transmission message carries compressed data, and the compressed data is performed on the original data by any one of the first terminal and the second terminal get compressed.
第四方面,本申请提供了一种数据传输装置,其特征在于,应用于第二终端,装置包括:In a fourth aspect, the present application provides a data transmission device, which is applied to a second terminal, and the device includes:
第二接收模块,用于接收第一终端发送的请求报文,请求报文携带有压缩标识;The second receiving module is configured to receive a request message sent by the first terminal, where the request message carries a compression identifier;
第二发送模块,用于基于请求报文向第一终端反馈响应报文,响应报文用于表示第二终端接收到压缩标识;The second sending module is configured to feed back a response message to the first terminal based on the request message, and the response message is used to indicate that the second terminal has received the compressed identifier;
第二数据交互模块,用于根据压缩标识,与第一终端进行数据传输报文的交互,数据传输报文携带有压缩数据,压缩数据由第一终端或第二终端对原始数据进行压缩得到。The second data interaction module is configured to interact with the first terminal on the data transmission message according to the compression identifier. The data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by the first terminal or the second terminal.
第五方面,本申请提供了种电子设备,包括存储器和一个或多个处理器,存储器存储有计算机可读指令,一个或多个处理器执行计算机可读指令时实现上述的方法的步骤。In a fifth aspect, the present application provides an electronic device, including a memory and one or more processors, the memory stores computer-readable instructions, and the one or more processors execute the computer-readable instructions to implement the steps of the above method.
第六方面,本申请提供了一种计算机可读存储介质,其上存储有计算机可读指令,计算机可读指令被一个或多个处理器执行时实现上述的方法的步骤。In a sixth aspect, the present application provides a computer-readable storage medium, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by one or more processors, the steps of the above method are implemented.
第七方面,本申请提供了一种计算机程序产品,包括计算机可读指令,该计算机可读指令被一个或多个处理器执行时实现上述的方法的步骤。In a seventh aspect, the present application provides a computer program product, including computer readable instructions, which implement the steps of the above method when executed by one or more processors.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。The details of one or more embodiments of the application are set forth in the accompanying drawings and the description below. Other features, objects and advantages of the present application will be apparent from the description, drawings and claims.
附图说明Description of drawings
为了更好地描述和说明这里公开的那些发明的实施例和或示例,可以参考以下一幅或多幅附图。用于描述附图的附加细书或示例不应当被认为是对所公开的发明、目前描述的实施例和或示例以及目前理解的这些发明的最佳模式中的任何一者的范围的限制。In order to better describe and illustrate embodiments and or examples of the inventions disclosed herein, reference is made to one or more of the following drawings. The accompanying specification or examples used to describe the drawings should not be considered limiting of the scope of any of the disclosed inventions, the presently described embodiments and or examples, and the best mode of these inventions currently understood.
图1为一个实施例中的数据传输方法的应用环境示意图;Fig. 1 is a schematic diagram of an application environment of a data transmission method in an embodiment;
图2为一个实施例中的数据传输方法的流程示意图;Fig. 2 is a schematic flow chart of a data transmission method in an embodiment;
图3为一个实施例中的MQTT协议的连接请求的数据包格式示 意图;Fig. 3 is a schematic diagram of the packet format of the connection request of the MQTT protocol in an embodiment;
图4为一个实施例中的MQTT协议的通信流程示意图;Fig. 4 is a schematic diagram of the communication flow of the MQTT protocol in an embodiment;
图5为另一个实施例中的数据传输方法的流程示意图;FIG. 5 is a schematic flow diagram of a data transmission method in another embodiment;
图6为另一个实施例中的数据传输方法的流程示意图;Fig. 6 is a schematic flow chart of a data transmission method in another embodiment;
图7为一个实施例中的数据传输装置的结构示意图;FIG. 7 is a schematic structural diagram of a data transmission device in an embodiment;
图8为一个实施例中的数据传输装置的结构示意图;FIG. 8 is a schematic structural diagram of a data transmission device in an embodiment;
图9为一个实施例中的电子设备的内部结构示意图。Fig. 9 is a schematic diagram of the internal structure of an electronic device in one embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solution and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described here are only used to explain the present application, and are not intended to limit the present application.
参考图1,图1为一个实施例中的数据传输方法的应用环境示意图。本申请实施例提供的数据传输方法,可以应用于如图1所示的应用环境中。其中,第一终端110和第二终端120通过特定的通信协议进行数据传输。Referring to FIG. 1 , FIG. 1 is a schematic diagram of an application environment of a data transmission method in an embodiment. The data transmission method provided in the embodiment of the present application may be applied in the application environment shown in FIG. 1 . Wherein, the first terminal 110 and the second terminal 120 perform data transmission through a specific communication protocol.
示例性的,第一终端110和第二终端120通过MQTT(消息队列遥测传输,Message Queuing Telemetry Transport)协议传输。MQTT是一个基于客户端-服务器的消息发布/订阅传输协议。MQTT协议是轻量、简单、开放和易于实现的,这些特点使它适用范围非常广泛。在很多情况下,包括受限的环境中,如:机器与机器(M2M)通信和物联网(IoT)。其在,通过卫星链路通信传感器、偶尔拨号的医疗设备、智能家居、及一些小型化设备中已广泛使用。在第一终端110和第二终端120通过MQTT协议传输数据的情况下,第一终端110和第二终端120发送数据的一方,将数据填充至PUBLISH(发布)报文发送,可以理解,发布报文可以是数据传输报文的一种实现方式。通过填充有数据的PUBLISH报文发送至第一终端110和第二终端120接收数据的一方。Exemplarily, the first terminal 110 and the second terminal 120 are transmitted through MQTT (Message Queuing Telemetry Transport) protocol. MQTT is a client-server based message publish/subscribe transport protocol. The MQTT protocol is lightweight, simple, open and easy to implement. These characteristics make it widely applicable. In many cases, including constrained environments such as machine-to-machine (M2M) communication and the Internet of Things (IoT). It is used extensively in sensors communicating via satellite links, medical devices that occasionally dial, smart homes, and some miniaturized devices. In the case that the first terminal 110 and the second terminal 120 transmit data through the MQTT protocol, the party that sends the data from the first terminal 110 and the second terminal 120 fills the data into the PUBLISH (release) message and sends it. It can be understood that the publish message A message may be an implementation of a data transmission message. The PUBLISH message filled with data is sent to the party receiving the data from the first terminal 110 and the second terminal 120 .
需要说明的是,第一终端110和第二终端120通过MQTT协议连接的情况下,第一终端110可以看做是设备端,第二终端120可以看作是服务端。It should be noted that, when the first terminal 110 and the second terminal 120 are connected through the MQTT protocol, the first terminal 110 may be regarded as a device end, and the second terminal 120 may be regarded as a server end.
其中,第一终端110和第二终端120可以但不限于是个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能音箱、智能电视、智能空调、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。Among them, the first terminal 110 and the second terminal 120 can be, but not limited to, personal computers, notebook computers, smart phones, tablet computers, Internet of Things devices and portable wearable devices, and the Internet of Things devices can be smart speakers, smart TVs, smart air conditioners , Smart vehicle equipment, etc. Portable wearable devices can be smart watches, smart bracelets, head-mounted devices, and the like.
参考图2,图2为一个实施例中的数据传输方法的流程示意图。在一个实施例中,如图2所示,提供了一种数据传输方法,以该方法应用于图1中的第一终端为例进行说明,包括步骤210至步骤230。Referring to FIG. 2 , FIG. 2 is a schematic flowchart of a data transmission method in an embodiment. In one embodiment, as shown in FIG. 2 , a data transmission method is provided. The method is applied to the first terminal in FIG. 1 as an example for illustration, including steps 210 to 230 .
步骤210、向第二终端发送请求报文,请求报文携带有压缩标识。Step 210: Send a request message to the second terminal, where the request message carries a compression identifier.
其中,请求报文是第一终端向第二终端发送。压缩标识指的是请求报文中携带的标识,压缩标识用于指示第二终端后续与第一终端交互的数据传输报文都是携带压缩数据。Wherein, the request message is sent by the first terminal to the second terminal. The compression identifier refers to the identifier carried in the request message, and the compression identifier is used to indicate that the subsequent data transmission messages that the second terminal interacts with the first terminal carry compressed data.
在一些实施例中,数据传输报文可以是发布报文。In some embodiments, the data transfer message may be a publication message.
步骤220、接收第二终端基于请求报文反馈的响应报文,响应报文用于表示第二终端接收到压缩标识。Step 220: Receive a response message fed back by the second terminal based on the request message, where the response message is used to indicate that the second terminal has received the compressed identifier.
其中,响应报文是指第二终端基于请求报文生成的。在本实施例中,第一终端接收到第二终端基于请求报文反馈的响应报文,而响应报文用于表示第二终端接收到压缩标识,由此第一终端可以确保第二终端接收到压缩标识,后续进行压缩数据的交互。Wherein, the response message refers to that generated by the second terminal based on the request message. In this embodiment, the first terminal receives the response message fed back by the second terminal based on the request message, and the response message is used to indicate that the second terminal has received the compressed identifier, so that the first terminal can ensure that the second terminal receives to the compression flag, and then interact with the compressed data.
步骤230、根据压缩标识,与第二终端进行数据传输报文的交互,数据传输报文携带有压缩数据,所述压缩数据由第一终端和第二终端中的任意一个对原始数据进行压缩得到。Step 230: According to the compression identifier, interact with the second terminal on the data transmission message, the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the first terminal and the second terminal .
在本实施例中,第一终端与第二终端进行数据传输报文的交互,可以是第一终端向第二终端发送数据传输报文,也可以是第一终端接收第二终端发送的数据传输报文,与实际的报文交互的结果确定,本实施例不作限定。具体的,若第一终端向第二终端发送数据传输报文,则压缩数据由第一终端对原始数据进行压缩得到;若第一终端接收第二终端发送的数据传输报文。则压缩数据由第二终端对原始数据进行压缩得到。本实施例中,数据传输报文携带的是压缩数据,因此,数据传输报文的数据大小更低。In this embodiment, the interaction between the first terminal and the second terminal for data transmission messages may be that the first terminal sends a data transmission message to the second terminal, or that the first terminal receives a data transmission message sent by the second terminal. The message is determined by the result of interaction with the actual message, which is not limited in this embodiment. Specifically, if the first terminal sends a data transmission message to the second terminal, the compressed data is obtained by compressing the original data by the first terminal; if the first terminal receives the data transmission message sent by the second terminal. Then the compressed data is obtained by compressing the original data by the second terminal. In this embodiment, the data transmission message carries compressed data, so the data size of the data transmission message is lower.
本实施例的技术方案,由于第一终端向第二终端发送请求报文后,第一终端和第二终端后续交互的数据传输报文中,数据传输报文携带的数据都是压缩数据,而压缩后的数据的数据大小必然更低,因此,即使是网络资源占用比较严重,或者是网络带宽较低的情况下,也能及时地进行数据的传输,避免了数据传输延时过高的问题,实现了提高数据传输的实时性的技术效果。另外,第一终端向第二终端发送请求报文后,第一终端和第二终端后续交互的数据都是携带压缩数据的数据传输报文,即发送一次请求报文即可实现第一终端和第二终端都进行压缩数据的交互,不需要每次压缩数据都发送一个请求报文,提高了压缩数据传输的效率和简易性。In the technical solution of this embodiment, after the first terminal sends a request message to the second terminal, in the subsequent data transmission message exchanged between the first terminal and the second terminal, the data carried in the data transmission message is all compressed data, and The data size of the compressed data must be lower. Therefore, even if the network resources are seriously occupied or the network bandwidth is low, the data can be transmitted in a timely manner, avoiding the problem of excessive data transmission delay. , realizing the technical effect of improving the real-time performance of data transmission. In addition, after the first terminal sends a request message to the second terminal, the subsequent data exchange between the first terminal and the second terminal is a data transmission message carrying compressed data, that is, sending a request message once can realize the communication between the first terminal and the second terminal. The second terminals all perform the exchange of compressed data, and do not need to send a request message every time the compressed data is compressed, which improves the efficiency and simplicity of compressed data transmission.
在一个可能的实施方式中,数据传输报文包括第一数据传输报文和第二数据传输报文中的至少一个,第一数据传输报文为第一终端向第二终端发送的数据传输报文,第二数据传输报文为第二终端向第一终端发送的数据传输报文,与第二终端进行数据传输报文的交互,包括:In a possible implementation manner, the data transmission message includes at least one of a first data transmission message and a second data transmission message, and the first data transmission message is a data transmission message sent by the first terminal to the second terminal. The second data transmission message is a data transmission message sent by the second terminal to the first terminal, and the data transmission message interaction with the second terminal includes:
在向第二终端发送第一数据传输报文的情况下,第一终端对第一 原始数据进行压缩处理,得到第一压缩数据,并将第一压缩数据填充至第一数据传输报文,将填充后的第一数据传输报文发送至第二终端;In the case of sending the first data transmission message to the second terminal, the first terminal compresses the first original data to obtain the first compressed data, and fills the first compressed data into the first data transmission message, and sending the filled first data transmission message to the second terminal;
在接收到第二终端发送的第二数据传输报文的情况下,第一终端获取第二数据传输报文携带的第二压缩数据,并对第二压缩数据进行解压处理,得到第二原始数据。In the case of receiving the second data transmission message sent by the second terminal, the first terminal acquires the second compressed data carried in the second data transmission message, and decompresses the second compressed data to obtain the second original data .
在本实施方式中,第一数据传输报文携带有第一压缩数据。第二数据传输报文携带有第二压缩数据。具体的,可以是只有第一终端向第二终端发送的第一压缩数据,也可以是第二终端向第一终端发送的第二压缩数据。其中,第一压缩数据指的是第一终端对第一原始数据进行压缩处理后得到的数据。第一原始数据指的是需要发送的,但是未经压缩处理的数据。第二压缩数据指的是第二终端对第二原始数据进行压缩处理后得到的数据。第二原始数据指的是需要发送的,但是未经压缩处理的数据。In this embodiment, the first data transmission packet carries the first compressed data. The second data transmission message carries the second compressed data. Specifically, it may be only the first compressed data sent by the first terminal to the second terminal, or it may be the second compressed data sent by the second terminal to the first terminal. Wherein, the first compressed data refers to data obtained after the first terminal compresses the first original data. The first original data refers to data that needs to be sent but has not been compressed. The second compressed data refers to data obtained after the second terminal compresses the second original data. The second original data refers to data that needs to be sent but has not been compressed.
需要说明的是,在第一终端向第二终端发送第一数据传输报文的情况下,第一终端对第一原始数据进行压缩处理得到第一压缩数据,并将第一压缩数据填充至第一数据传输报文,从而将携带有第一压缩数据的第一数据传输报文发送至第二终端。在第一终端接收第二终端发送的第二数据传输报文的情况下,第一终端从第二数据传输报文中提取第二压缩数据,并对第二压缩数据进行解压处理得到第二原始数据。It should be noted that, when the first terminal sends the first data transmission message to the second terminal, the first terminal compresses the first original data to obtain the first compressed data, and fills the first compressed data into the second A data transmission message, so that the first data transmission message carrying the first compressed data is sent to the second terminal. When the first terminal receives the second data transmission message sent by the second terminal, the first terminal extracts the second compressed data from the second data transmission message, and decompresses the second compressed data to obtain the second original data.
可选的,第一终端和第二终端每次在发送数据或接收数据的情况下,确认最新的请求报文,若最新的请求报文携带有压缩标识,则执行解压缩操作。Optionally, the first terminal and the second terminal confirm the latest request message each time they send data or receive data, and if the latest request message carries a compression identifier, perform a decompression operation.
在一个可能的实施方式中,向第二终端发送请求报文,包括:In a possible implementation manner, sending the request message to the second terminal includes:
第一终端确认是否满足与第二终端交互压缩数据的预设条件;The first terminal confirms whether a preset condition for exchanging compressed data with the second terminal is met;
在满足预设条件的情况下,向第二终端发送请求报文。If the preset condition is met, the request message is sent to the second terminal.
在本实施方式中,第一终端确认是否满足与第二终端交互压缩数据的预设条件,若满足,则对交互的数据进行压缩,从而向第二终端发送请求报文,从而使得第一终端和第二终端在后续交互的数据都是经过压缩的数据,从而提高数据传输的时效性。In this embodiment, the first terminal confirms whether the preset condition for exchanging compressed data with the second terminal is met, and if so, compresses the exchanged data, thereby sending a request message to the second terminal, so that the first terminal The data that is subsequently interacted with the second terminal is compressed data, thereby improving the timeliness of data transmission.
在一个可能的实施方式中,满足预设条件包括以下的至少一项:In a possible implementation manner, meeting the preset conditions includes at least one of the following:
第一终端响应用户设置压缩数据的设置操作;The first terminal responds to the setting operation of setting the compressed data by the user;
第一终端通过SIM卡传输数据。The first terminal transmits data through the SIM card.
在本实施方式中,可以是通过用户将第一终端设置为压缩数据的模式,则第一终端响应用户设置压缩数据的设置操作,向第二终端发送请求报文。此外,一般的,第一终端可以通过WiFi网络或SIM卡向第二终端传输数据。然而,当第一终端通过SIM卡传输数据时,由于SIM卡的使用流量是有限的,因此,在第一终端准备通过SIM 卡传输数据的情况下,向第二终端发送请求报文,则后续通过SIM卡传输的数据都是压缩数据,可以减少SIM卡的流量消耗。In this embodiment, it may be that the user sets the first terminal to the compressed data mode, and the first terminal sends a request message to the second terminal in response to the user's setting operation of setting the compressed data. In addition, generally, the first terminal may transmit data to the second terminal through a WiFi network or a SIM card. However, when the first terminal transmits data through the SIM card, since the usage traffic of the SIM card is limited, when the first terminal prepares to transmit data through the SIM card, it sends a request message to the second terminal, and the subsequent The data transmitted through the SIM card is compressed data, which can reduce the traffic consumption of the SIM card.
在一个可能的实施方式中,第一终端与第二终端通过MQTT协议进行数据的交互。可选的,请求报文为第一终端与第二终端建立连接时发送的连接请求报文。在本实施例中,若请求报文为连接请求报文,则压缩标识配置在连接请求的连接标志字段。In a possible implementation manner, the first terminal and the second terminal perform data interaction through the MQTT protocol. Optionally, the request message is a connection request message sent when the first terminal establishes a connection with the second terminal. In this embodiment, if the request message is a connection request message, the compression identifier is configured in the connection flag field of the connection request.
需要说明的是,若请求报文为连接请求报文,则响应报文为连接响应报文。It should be noted that, if the request packet is a connection request packet, the response packet is a connection response packet.
可以理解的是,请求报文为第一终端与第二终端建立连接时发送的连接请求报文,相当于第一终端在于第二终端建立连接的过程中就将压缩标识发送至第二终端,则第一终端与第二终端建立连接完成后,交互的数据都是压缩数据。It can be understood that the request message is a connection request message sent when the first terminal establishes a connection with the second terminal, which is equivalent to that the first terminal sends the compressed identifier to the second terminal during the process of establishing the connection with the second terminal. Then, after the connection between the first terminal and the second terminal is established, the data exchanged are all compressed data.
如图3所示,图3为一个实施例中的MQTT协议的连接请求的数据包格式示意图。如图3所示,压缩标识配置在连接请求的连接标志字段(Connect Flags),一般的,由于连接标志字段在连接请求中并未有实质作用,而本实施例通过复用连接请求的连接标志字段,不需要更改请求报文的数据包格式,只需要在连接标志字段配置压缩字段即可,降低了向第二终端发送请求报文的复杂度。可选的,压缩标识可以是“0”,也可以是“1”。示例性的,压缩标识为“1”,则连接标志字段的值为0表示不压缩,连接标志字段的值为1表示压缩。As shown in FIG. 3 , FIG. 3 is a schematic diagram of a data packet format of a connection request of the MQTT protocol in an embodiment. As shown in Figure 3, the compression flag is configured in the connection flag field (Connect Flags) of the connection request. Generally, since the connection flag field does not have a substantial effect in the connection request, this embodiment uses the connection flag of the multiplex connection request field, there is no need to change the data packet format of the request message, only need to configure the compression field in the connection flag field, which reduces the complexity of sending the request message to the second terminal. Optionally, the compression flag can be "0" or "1". Exemplarily, if the compression flag is "1", then the value of the connection flag field is 0, which means no compression, and the value of the connection flag field, which is 1, means compression.
参考图4,图4为一个实施例中的MQTT协议的通信流程示意图。如图1所示,第一终端在向第二终端发送请求报文后,第一终端和第二终端发送PUBLISH报文的其中一方,都需要对数据先进行压缩,再发送PUBLISH报文,则接收PUBLISH报文的一方,需要从接收的PUBLISH报文中获取压缩数据,进而对压缩数据进行解压处理。Referring to FIG. 4 , FIG. 4 is a schematic diagram of a communication flow of the MQTT protocol in an embodiment. As shown in Figure 1, after the first terminal sends a request message to the second terminal, one of the first terminal and the second terminal that sends the PUBLISH message needs to compress the data before sending the PUBLISH message, then The party receiving the PUBLISH message needs to obtain the compressed data from the received PUBLISH message, and then decompress the compressed data.
在一个可能的实施方式中,对第一原始数据进行压缩处理得到第一压缩数据,包括:In a possible implementation manner, performing compression processing on the first original data to obtain the first compressed data includes:
第一终端调用预设压缩算法;calling a preset compression algorithm by the first terminal;
通过预设压缩算法对第一原始数据进行压缩得到第一压缩数据。The first original data is compressed by a preset compression algorithm to obtain the first compressed data.
其中,预设压缩算法可以是预先配置的压缩算法。可选的,预设压缩算法可以是一个,也可以是多个。在本实施方式中,在需要对待传输的第一原始数据进行压缩的情况下,通过预设压缩算法对第一原始数据进行压缩。Wherein, the preset compression algorithm may be a pre-configured compression algorithm. Optionally, there may be one or more preset compression algorithms. In this embodiment, if the first original data to be transmitted needs to be compressed, the first original data is compressed by using a preset compression algorithm.
需要说明的是,若预设压缩算法为一个,则第一终端通过固定的预设压缩算法进行第一原始数据的压缩。可选的,预设压缩算法可以是LZMA压缩算法。LZMA压缩算法优点:高压缩比;解压缩代码较小:约5KB;解压缩时仅需少量内存(取决于字典大小);可变更字典大小(最大4GB);压缩速度:在一部2GHz的处理器上运行, 约可达到1MB每秒的速度;解压缩速度:在一部2GHz的处理器上运行,约可达10-20MB每秒的速度;支持多线程、多核心(多处理器)和Pentium 4处理器的超线程(Hyper-Threading);以上特点使得LZMA算法的非常适合于嵌入式系统应用的场合。It should be noted that, if there is one preset compression algorithm, the first terminal compresses the first original data by using a fixed preset compression algorithm. Optionally, the preset compression algorithm may be an LZMA compression algorithm. Advantages of LZMA compression algorithm: high compression ratio; small decompression code: about 5KB; only a small amount of memory is needed for decompression (depending on the dictionary size); the dictionary size can be changed (up to 4GB); compression speed: processing in a 2GHz Running on a server, it can reach a speed of about 1MB per second; decompression speed: running on a 2GHz processor, it can reach a speed of about 10-20MB per second; supports multi-threading, multi-core (multi-processor) and Hyper-Threading of the Pentium 4 processor; the above characteristics make the LZMA algorithm very suitable for embedded system applications.
相应的,在一个可能的实施方式中,对第二压缩数据进行解压处理得到第二原始数据,包括:Correspondingly, in a possible implementation manner, decompressing the second compressed data to obtain the second original data includes:
第一终端调用预设解压算法;calling a preset decompression algorithm by the first terminal;
通过预设解压算法对第二压缩数据进行解压处理得到第二原始数据。The second original data is obtained by decompressing the second compressed data through a preset decompression algorithm.
其中,预设解压算法可以是预先配置的解压算法。可选的,预设解压算法可以是一个,也可以是多个。一般的,预设解压算法的数量与预设压缩算法的数量一致。在本实施方式中,在需要对接收的第二压缩数据进行解压的情况下,通过预设解压算法对第二压缩数据进行压缩。Wherein, the preset decompression algorithm may be a pre-configured decompression algorithm. Optionally, there may be one or more preset decompression algorithms. Generally, the number of preset decompression algorithms is the same as the number of preset compression algorithms. In this embodiment, when the received second compressed data needs to be decompressed, the second compressed data is compressed by using a preset decompression algorithm.
需要说明的是,若预设解压算法为一个,则第一终端通过固定的预设解压算法进行第二压缩数据的解压。可选的,预设解压算法可以是LZMA解压算法。It should be noted that, if there is one preset decompression algorithm, the first terminal decompresses the second compressed data by using a fixed preset decompression algorithm. Optionally, the preset decompression algorithm may be an LZMA decompression algorithm.
在一个可能的实施方式中,预设压缩算法为多个,请求报文还携带有压缩算法标识,调用预设压缩算法,通过预设压缩算法对第一原始数据进行压缩得到第一压缩数据,包括:In a possible implementation manner, there are multiple preset compression algorithms, the request message also carries a compression algorithm identifier, and the preset compression algorithm is called, and the first original data is compressed by the preset compression algorithm to obtain the first compressed data, include:
第一终端调用与压缩算法标识对应的目标压缩算法,目标压缩算法为多个预设压缩算法的其中一个;The first terminal invokes a target compression algorithm corresponding to the compression algorithm identifier, where the target compression algorithm is one of multiple preset compression algorithms;
通过目标压缩算法对第一原始数据进行压缩得到第一压缩数据。The first original data is compressed by the target compression algorithm to obtain the first compressed data.
其中,压缩算法标识用于表示用多个预设压缩算法中的哪个预设压缩算法进行数据的压缩。可选的,多个预设压缩算法包括但不限于LZMA压缩算法、LZ4压缩算法、霍夫曼压缩算法、游程编码算法等中的至少两个。Wherein, the compression algorithm identifier is used to indicate which preset compression algorithm among multiple preset compression algorithms is used for data compression. Optionally, the multiple preset compression algorithms include but are not limited to at least two of LZMA compression algorithm, LZ4 compression algorithm, Huffman compression algorithm, run-length coding algorithm, and the like.
需要说明的是,第一终端将携带有压缩算法标识的请求报文发送至第二终端,并接收到响应报文后,第一终端和第二终端发送数据的一方,先查询最新的请求报文,从而通过目标压缩算法标识对应的目标压缩算法进行数据的压缩;其中,目标压缩算法标识是最新的请求报文中的压缩算法标识。It should be noted that the first terminal sends the request message carrying the compression algorithm identifier to the second terminal, and after receiving the response message, the party that sends data between the first terminal and the second terminal first queries the latest request message file, so that the data is compressed through the target compression algorithm corresponding to the target compression algorithm identifier; wherein, the target compression algorithm identifier is the compression algorithm identifier in the latest request message.
在一个可能的实施方式中,压缩算法标识是根据交互的数据的数据类型确定的。可选的,数据类型用于表示第一原始数据的类型。示例性的,数据类型包括但不限于视频数据和语音数据。压缩算法标识是根据第一原始数据的数据类型得到的,换句话说,压缩算法标识与第一原始数据的数据类型对应。示例性的,假设多个预设压缩算法包括LZMA压缩算法和LZ4压缩算法,则在与压缩标识所在的字段 以外的其他字段中,“0”表示LZMA压缩算法,“1”表示LZ4压缩算法。In a possible implementation manner, the compression algorithm identifier is determined according to the data type of the data to be interacted with. Optionally, the data type is used to represent the type of the first original data. Exemplarily, the data type includes but not limited to video data and voice data. The compression algorithm identifier is obtained according to the data type of the first original data. In other words, the compression algorithm identifier corresponds to the data type of the first original data. Exemplarily, assuming that multiple preset compression algorithms include the LZMA compression algorithm and the LZ4 compression algorithm, then in fields other than the field where the compression identifier is located, "0" indicates the LZMA compression algorithm, and "1" indicates the LZ4 compression algorithm.
可选的,对于视频数据来说,其的数据量较大,因此可以采用压缩率较高的压缩算法进行压缩,尽可能降低视频数据的数据量大小;对于语音数据来说,其的数据量较小,因此可以通过压缩速度较高的压缩算法,尽可能快的压缩完成,从而提高语音数据的压缩速率,进一步提高数据传输的实时性。Optionally, for video data, its data volume is relatively large, so a compression algorithm with a higher compression rate can be used to compress, so as to reduce the data volume of video data as much as possible; for voice data, its data volume Smaller, so the compression algorithm with high compression speed can be used to complete the compression as fast as possible, thereby increasing the compression rate of voice data and further improving the real-time performance of data transmission.
相应的,在一个可能的实施方式中,预设解压算法为多个,请求报文还携带有解压算法标识,调用预设解压算法,通过预设解压算法对第二压缩数据进行解压处理得到第二原始数据,包括:Correspondingly, in a possible implementation manner, there are multiple preset decompression algorithms, and the request message also carries a decompression algorithm identifier, and the preset decompression algorithm is called, and the second compressed data is decompressed by the preset decompression algorithm to obtain the second compressed data. 2. Raw data, including:
第一终端调用与解压算法标识对应的目标解压算法,目标解压算法为多个预设解压算法的其中一个;The first terminal invokes a target decompression algorithm corresponding to the decompression algorithm identifier, where the target decompression algorithm is one of multiple preset decompression algorithms;
通过目标解压算法对第二压缩数据进行解压处理,得到第二原始数据。The second compressed data is decompressed by the target decompression algorithm to obtain the second original data.
其中,解压算法标识还用于表示多个预设解压算法的哪个预设解压算法进行数据的解压。可选的,多个预设解压算法包括但不限于LZMA解压算法、LZ4解压算法、霍夫曼解压算法、游程解码算法等中的至少两个。Wherein, the decompression algorithm identifier is also used to indicate which preset decompression algorithm among the multiple preset decompression algorithms performs data decompression. Optionally, the multiple preset decompression algorithms include but are not limited to at least two of LZMA decompression algorithm, LZ4 decompression algorithm, Huffman decompression algorithm, run-length decoding algorithm, and the like.
在一个可能的实施方式中,解压算法标识是根据交互的数据的数据类型确定的,与压缩算法标识相对应。In a possible implementation manner, the decompression algorithm identifier is determined according to the data type of the data to be interacted with, and corresponds to the compression algorithm identifier.
需要说明的是,第一终端将携带有解压算法标识的请求报文发送至第二终端后,第一终端和第二终端接收数据的一方,先查询最新的请求报文,从而通过目标解压算法标识对应的目标解压算法进行数据的解压,其中,目标解压算法标识是最新的请求报文中的解压算法标识。It should be noted that after the first terminal sends the request message carrying the decompression algorithm identifier to the second terminal, the party receiving the data from the first terminal and the second terminal first queries the latest request message, so as to pass the target decompression algorithm The corresponding target decompression algorithm is identified to decompress the data, wherein the target decompression algorithm identification is the decompression algorithm identification in the latest request message.
在本实施例中,第一终端在向第二终端发送请求报文的情况下,将压缩算法标识和解压算法标识一同发送至第二终端。第一终端与第二终端交互数据的过程中,第一终端和第二终端发送数据的一方,通过压缩算法标识对应的目标压缩算法对传输的数据进行压缩。而第一终端和第二终端接收数据的一方,通过解压算法标识对应的目标解压算法对压缩数据进行解压,从而还原数据。可选的,通过第一终端识别第一原始数据的数据类型,并获取数据类型对应的解压算法标识和压缩算法标识,从而将解压算法标识和压缩算法标识填充至请求报文,以将携带有解压算法标识和压缩算法标识的请求报文发送至第二终端。In this embodiment, when sending the request message to the second terminal, the first terminal sends the compression algorithm identifier and the decompression algorithm identifier to the second terminal together. In the process of exchanging data between the first terminal and the second terminal, the party that sends data between the first terminal and the second terminal compresses the transmitted data by using a target compression algorithm corresponding to the compression algorithm identifier. The first terminal and the second terminal receiving the data decompress the compressed data by using the target decompression algorithm identified by the decompression algorithm to restore the data. Optionally, the first terminal identifies the data type of the first original data, and obtains the decompression algorithm identification and compression algorithm identification corresponding to the data type, so as to fill the decompression algorithm identification and compression algorithm identification into the request message, so as to carry the The decompression algorithm identification and the request message of the compression algorithm identification are sent to the second terminal.
可以理解的是,本实施例通过第一终端在向第二终端发送请求报文的情况下,将压缩算法标识和解压算法标识一同发送至第二终端,而压缩算法标识和解压算法标识是根据交互的数据的数据类型确定 的,因此可以根据第一原始数据的数据类型采用不同的算法进行解压缩处理。It can be understood that in this embodiment, when the first terminal sends a request message to the second terminal, the compression algorithm identifier and the decompression algorithm identifier are sent to the second terminal together, and the compression algorithm identifier and the decompression algorithm identifier are based on The data type of the interactive data is determined, so different algorithms may be used for decompression processing according to the data type of the first original data.
一般的,压缩算法和解压算法都是相对应的,因此解压算法标识和压缩算法标识为一个算法标识,通过一个算法标识即可确定出对应的目标压缩算法或目标解压算法。Generally, the compression algorithm and the decompression algorithm are corresponding, so the decompression algorithm identification and the compression algorithm identification are an algorithm identification, and the corresponding target compression algorithm or target decompression algorithm can be determined through an algorithm identification.
可以理解的是,通过将解压算法标识和压缩算法标识作为一个算法标识,可以在改变请求报文的数据包格式时,可以减少改变数据包格式的复杂度,以及降低获取目标压缩算法或目标解压算法的复杂度。It can be understood that by using the decompression algorithm identification and the compression algorithm identification as an algorithm identification, when changing the data packet format of the request message, the complexity of changing the data packet format can be reduced, and the number of acquisition target compression algorithms or target decompression algorithms can be reduced. The complexity of the algorithm.
参考图5,图5为另一个实施例中的数据传输方法的流程示意图。在一个实施例中,如图5所示,提供了一种数据传输方法,以该方法应用于图1中的第二终端为例进行说明,包括步骤510至步骤530。Referring to FIG. 5 , FIG. 5 is a schematic flowchart of a data transmission method in another embodiment. In one embodiment, as shown in FIG. 5 , a data transmission method is provided, which is described by taking the method applied to the second terminal in FIG. 1 as an example, including steps 510 to 530 .
步骤510、接收第一终端发送的请求报文,请求报文携带有压缩标识。Step 510: Receive a request message sent by the first terminal, where the request message carries a compression identifier.
步骤520、基于请求报文向第一终端反馈响应报文,反馈响应报文用于表示第二终端接收到压缩标识。Step 520: Feedback a response message to the first terminal based on the request message, where the feedback response message is used to indicate that the second terminal has received the compression identifier.
步骤530、根据压缩标识,与第一终端进行数据传输报文的交互,数据传输报文携带有压缩数据,压缩数据由第一终端中第二终端的任意一个对原始数据进行压缩得到。Step 530: According to the compression identifier, interact with the first terminal in the data transmission message, the data transmission message carries compressed data, and the compressed data is obtained by compressing the original data by any one of the second terminals in the first terminal.
本实施例的技术方案,由于第一终端向第二终端发送请求报文后,第一终端和第二终端后续交互的数据传输报文中,数据传输报文携带的数据都是压缩数据,而压缩后的数据的数据大小必然更低,因此,即使是网络资源占用比较严重,或者是网络带宽较低的情况下,也能及时地进行数据的传输,避免了数据传输延时过高的问题,实现了提高数据传输的实时性的技术效果。另外,第一终端向第二终端发送请求报文后,第一终端和第二终端后续交互的数据都是携带压缩数据的数据传输报文,即发送一次请求报文即可实现第一终端和第二终端都进行压缩数据的交互,不需要每次压缩数据都发送一个请求报文,提高了压缩数据传输的效率和简易性。In the technical solution of this embodiment, after the first terminal sends a request message to the second terminal, in the subsequent data transmission message exchanged between the first terminal and the second terminal, the data carried in the data transmission message is all compressed data, and The data size of the compressed data must be lower. Therefore, even if the network resources are seriously occupied or the network bandwidth is low, the data can be transmitted in a timely manner, avoiding the problem of excessive data transmission delay. , realizing the technical effect of improving the real-time performance of data transmission. In addition, after the first terminal sends a request message to the second terminal, the subsequent data exchange between the first terminal and the second terminal is a data transmission message carrying compressed data, that is, sending a request message once can realize the communication between the first terminal and the second terminal. The second terminals all perform the exchange of compressed data, and do not need to send a request message every time the compressed data is compressed, which improves the efficiency and simplicity of compressed data transmission.
在一个可能的实施方式中,数据传输报文包括第一数据传输报文和第二数据传输报文中的至少一个,第一数据传输报文为第一终端向第二终端发送的数据传输报文,第二数据传输报文为第二终端向第一终端发送的数据传输报文,与第二终端进行数据传输报文的交互,包括:In a possible implementation manner, the data transmission message includes at least one of a first data transmission message and a second data transmission message, and the first data transmission message is a data transmission message sent by the first terminal to the second terminal. The second data transmission message is a data transmission message sent by the second terminal to the first terminal, and the data transmission message interaction with the second terminal includes:
在接收到第一终端发送的第一数据传输报文的情况下,第二终端获取第一数据传输报文携带的第一压缩数据,并对第一压缩数据进行解压处理得到第一原始数据;In the case of receiving the first data transmission message sent by the first terminal, the second terminal obtains the first compressed data carried in the first data transmission message, and decompresses the first compressed data to obtain the first original data;
在向第一终端发送第二数据传输报文的情况下,第二终端对第二原始数据进行压缩处理得到,第二压缩数据,并将第二压缩数据填充 至第二数据传输报文,将填充后的第二数据传输报文发送至第一终端;In the case of sending the second data transmission message to the first terminal, the second terminal compresses the second original data to obtain the second compressed data, and fills the second compressed data into the second data transmission message, and the sending the filled second data transmission message to the first terminal;
在一个可能的实施方式中,第二终端对待传输的第二原始数据进行压缩得到第二压缩数据的步骤包括:In a possible implementation manner, the step of the second terminal compressing the second original data to be transmitted to obtain the second compressed data includes:
第二终端调用预设压缩算法;calling a preset compression algorithm by the second terminal;
通过预设压缩算法对第二原始数据进行压缩得到第二压缩数据。The second original data is compressed by a preset compression algorithm to obtain second compressed data.
在一个可能的实施方式中,预设压缩算法为多个,第二终端调用预设压缩算法,通过预设压缩算法对第二原始数据进行压缩得到第二压缩数据,包括:In a possible implementation, there are multiple preset compression algorithms, and the second terminal invokes the preset compression algorithm to compress the second original data through the preset compression algorithm to obtain the second compressed data, including:
第二终端调用与压缩算法标识对应的目标压缩算法,目标压缩算法为多个预设压缩算法的其中一个;The second terminal invokes a target compression algorithm corresponding to the compression algorithm identifier, where the target compression algorithm is one of multiple preset compression algorithms;
通过目标压缩算法对第二原始数据进行压缩得到第二压缩数据。The second original data is compressed by using a target compression algorithm to obtain second compressed data.
在一个可能的实施方式中,第二终端对第一压缩数据进行解压处理得到第一原始数据,包括:In a possible implementation manner, the second terminal decompresses the first compressed data to obtain the first original data, including:
第二终端调用预设解压算法;The second terminal invokes a preset decompression algorithm;
通过预设解压算法对第一压缩数据进行解压处理得到第一原始数据。The first original data is obtained by decompressing the first compressed data through a preset decompression algorithm.
在一个可能的实施方式中,预设解压算法为多个,第二终端调用预设解压算法,通过预设解压算法对第一压缩数据进行解压处理得到第一原始数据,包括:In a possible implementation, there are multiple preset decompression algorithms, and the second terminal invokes the preset decompression algorithm, and decompresses the first compressed data through the preset decompression algorithm to obtain the first original data, including:
第二终端调用与解压算法标识对应的目标解压算法,目标解压算法为多个预设解压算法的其中一个;The second terminal invokes a target decompression algorithm corresponding to the decompression algorithm identifier, where the target decompression algorithm is one of multiple preset decompression algorithms;
通过目标解压算法对第一压缩数据进行解压处理得到第一原始数据。Decompressing the first compressed data by using the target decompression algorithm to obtain the first original data.
参考图6,图6为另一个实施例中的数据传输方法的流程示意图。在一个实施例中,如图6所示,提供了一种数据传输方法,以该方法应用于图1中的第一终端和第二终端为例进行说明。本实施例的数据传输方法包括步骤610至步骤650。Referring to FIG. 6 , FIG. 6 is a schematic flowchart of a data transmission method in another embodiment. In one embodiment, as shown in FIG. 6 , a data transmission method is provided, and the method is applied to the first terminal and the second terminal in FIG. 1 as an example for illustration. The data transmission method in this embodiment includes step 610 to step 650 .
步骤610、第一终端向第二终端发送请求报文,请求报文携带有压缩标识。 Step 610, the first terminal sends a request message to the second terminal, and the request message carries a compression identifier.
在本实施例中,可选的,第一终端可以在与第二终端建立连接的过程中,就将压缩标识发送至第二终端,则第一终端和第二终端在连接建立完成后,都进行压缩数据的交互。本实施例中,第一终端可以将连接请求报文作为请求报文发送至第二终端。In this embodiment, optionally, the first terminal may send the compression identifier to the second terminal during the process of establishing a connection with the second terminal, and after the connection is established, both the first terminal and the second terminal Interact with compressed data. In this embodiment, the first terminal may send the connection request message to the second terminal as a request message.
步骤620、第二终端接收第一终端发送的请求报文。Step 620, the second terminal receives the request message sent by the first terminal.
步骤630、第二终端响应请求报文,生成响应报文,向第一终端反馈响应报文。 Step 630, the second terminal responds to the request message, generates a response message, and feeds back the response message to the first terminal.
步骤640、第一终端接收第二终端反馈的响应报文。 Step 640, the first terminal receives the response message fed back by the second terminal.
在本实施例中,第一终端接收到第二终端反馈的响应报文后,则 第一终端可以认为第二终端已接收到该压缩标识,后续可以进行压缩数据的交互。In this embodiment, after the first terminal receives the response message fed back by the second terminal, the first terminal may consider that the second terminal has received the compression identifier, and may subsequently interact with compressed data.
步骤650、第一终端和第二终端根据压缩标识进行数据传输报文的交互,数据传输报文携带有压缩数据。 Step 650, the first terminal and the second terminal perform data transmission message interaction according to the compression identifier, and the data transmission message carries compressed data.
本实施例的技术方案,由于第一终端向第二终端发送请求报文后,第一终端和第二终端后续交互的数据传输报文中,数据传输报文携带的数据都是压缩数据,而压缩后的数据的数据大小必然更低,因此,即使是网络资源占用比较严重,或者是网络带宽较低的情况下,也能及时地进行数据的传输,避免了数据传输延时过高的问题,实现了提高数据传输的实时性的技术效果。另外,第一终端向第二终端发送请求报文后,第一终端和第二终端后续交互的数据都是携带压缩数据的数据传输报文,即发送一次请求报文即可实现第一终端和第二终端都进行压缩数据的交互,不需要每次压缩数据都发送一个请求报文,提高了压缩数据传输的效率和简易性。In the technical solution of this embodiment, after the first terminal sends a request message to the second terminal, in the subsequent data transmission message exchanged between the first terminal and the second terminal, the data carried in the data transmission message is all compressed data, and The data size of the compressed data must be lower. Therefore, even if the network resources are seriously occupied or the network bandwidth is low, the data can be transmitted in a timely manner, avoiding the problem of excessive data transmission delay. , realizing the technical effect of improving the real-time performance of data transmission. In addition, after the first terminal sends a request message to the second terminal, the subsequent data exchange between the first terminal and the second terminal is a data transmission message carrying compressed data, that is, sending a request message once can realize the communication between the first terminal and the second terminal. The second terminals all perform the exchange of compressed data, and do not need to send a request message every time the compressed data is compressed, which improves the efficiency and simplicity of compressed data transmission.
应该理解的是,虽然如上的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the steps in the flow charts involved in the above embodiments are shown sequentially according to the arrows, these steps are not necessarily executed sequentially in the order indicated by the arrows. Unless otherwise specified herein, there is no strict order restriction on the execution of these steps, and these steps can be executed in other orders. Moreover, at least some of the steps in the flow charts involved in the above embodiments may include multiple steps or stages, and these steps or stages are not necessarily executed at the same time, but may be executed at different times, The execution order of these steps or stages is not necessarily performed sequentially, but may be executed in turn or alternately with other steps or at least a part of steps or stages in other steps.
基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的数据传输方法的数据传输装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多数据传输装置实施例中的具体限定可以参见上文中对于数据传输方法的限定,在此不再赘述。Based on the same inventive concept, an embodiment of the present application further provides a data transmission device for implementing the above-mentioned data transmission method. The solution to the problem provided by the device is similar to the implementation described in the above method, so the specific limitations in one or more embodiments of the data transmission device provided below can refer to the definition of the data transmission method above, in This will not be repeated here.
参考图7,图7为一个实施例中的数据传输装置的结构示意图。在一个实施例中,如图7所示,提供了一种数据传输装置,以该装置应用于图1中的第一终端为例进行说明,包括第一发送模块710、第一接收模块720和第一数据交互模块730,其中:Referring to FIG. 7, FIG. 7 is a schematic structural diagram of a data transmission device in an embodiment. In one embodiment, as shown in FIG. 7 , a data transmission device is provided. The device is applied to the first terminal in FIG. 1 as an example, including a first sending module 710, a first receiving module 720 and The first data interaction module 730, wherein:
第一发送模块710,用于向第二终端发送请求报文,请求报文携带有压缩标识;第一接收模块720,用于接收第二终端基于请求报文反馈的响应报文,响应报文用于表示第二终端接收到压缩标识;第一数据交互模块730,用于根据压缩标识,与第二终端进行数据传输报文的交互,数据传输报文携带有压缩数据,压缩数据由第一终端或第二终端对原始数据进行压缩得到。The first sending module 710 is configured to send a request message to the second terminal, and the request message carries a compression identifier; the first receiving module 720 is configured to receive a response message fed back by the second terminal based on the request message, and the response message It is used to indicate that the second terminal has received the compressed identifier; the first data interaction module 730 is configured to interact with the second terminal on the data transmission message according to the compressed identifier, the data transmission message carries compressed data, and the compressed data is sent by the first The terminal or the second terminal compresses the original data to obtain it.
在其中一个实施例中,第一发送模块710具体用于确认是否满足与第二终端交互压缩数据的预设条件;在满足预设条件的情况下,向第二终端发送请求报文。In one embodiment, the first sending module 710 is specifically configured to confirm whether a preset condition for exchanging compressed data with the second terminal is met; if the preset condition is met, send a request message to the second terminal.
在其中一个实施例中,满足预设条件包括以下的至少一项:In one embodiment, meeting the preset conditions includes at least one of the following:
第一终端响应用户设置压缩数据的设置操作;第一终端通过SIM卡传输数据。The first terminal responds to the setting operation of setting the compressed data by the user; the first terminal transmits the data through the SIM card.
在其中一个实施例中,压缩标识配置在连接请求报文的连接标志字段。In one of the embodiments, the compression identifier is configured in the connection flag field of the connection request message.
在其中一个实施例中,数据传输报文包括第一数据传输报文和第二数据传输报文中的至少一个,第一数据传输报文为第一终端向第二终端发送的数据传输报文,第二数据传输报文为第二终端向第一终端发送的数据传输报文,第一数据交互模块730具体用于:In one of the embodiments, the data transmission message includes at least one of a first data transmission message and a second data transmission message, and the first data transmission message is a data transmission message sent by the first terminal to the second terminal , the second data transmission message is a data transmission message sent by the second terminal to the first terminal, and the first data interaction module 730 is specifically used for:
在向第二终端发送第一数据传输报文的情况下,对第一原始数据进行压缩处理得到第一压缩数据,并将第一压缩数据填充至第一数据传输报文后发送至第二终端;在接收到第二终端发送的第二数据传输报文的情况下,获取第二数据传输报文携带的第二压缩数据,并对第二压缩数据进行解压处理得到第二原始数据。In the case of sending the first data transmission message to the second terminal, performing compression processing on the first original data to obtain the first compressed data, filling the first compressed data into the first data transmission message and sending it to the second terminal ; When receiving the second data transmission message sent by the second terminal, obtain the second compressed data carried in the second data transmission message, and decompress the second compressed data to obtain the second original data.
在其中一个实施例中,第一数据交互模块730,包括:In one of the embodiments, the first data interaction module 730 includes:
第一压缩算法调用单元,用于调用预设压缩算法;A first compression algorithm calling unit, configured to call a preset compression algorithm;
第一压缩单元,用于通过预设压缩算法对第一原始数据进行压缩得到第一压缩数据。The first compression unit is configured to compress the first original data through a preset compression algorithm to obtain first compressed data.
在其中一个实施例中,预设压缩算法为多个,请求报文还携带有压缩算法标识,压缩算法标识是根据交互的数据的数据类型确定的,第一压缩单元具体用于调用与压缩算法标识对应的目标压缩算法,目标压缩算法为多个预设压缩算法的其中一个;通过目标压缩算法对第一原始数据进行压缩得到第一压缩数据。In one embodiment, there are multiple preset compression algorithms, and the request message also carries a compression algorithm identifier, which is determined according to the data type of the interactive data, and the first compression unit is specifically used to call and compress the algorithm A corresponding target compression algorithm is identified, and the target compression algorithm is one of a plurality of preset compression algorithms; the first original data is compressed by the target compression algorithm to obtain the first compressed data.
在其中一个实施例中,第一数据交互模块730,包括:In one of the embodiments, the first data interaction module 730 includes:
第一解压算法调用单元,用于调用预设解压算法;The first decompression algorithm calling unit is used to call the preset decompression algorithm;
第一解压单元,用于通过预设解压算法对第二压缩数据进行解压处理得到第二原始数据。The first decompression unit is configured to decompress the second compressed data through a preset decompression algorithm to obtain second original data.
在其中一个实施例中,预设解压算法为多个,请求报文还携带有解压标识,第一解压单元具体用于调用与解压算法标识对应的目标解压算法,目标解压算法为多个预设解压算法的其中一个;通过目标解压算法对第二压缩数据进行解压处理得到第二原始数据。In one embodiment, there are multiple preset decompression algorithms, and the request message also carries a decompression identifier, and the first decompression unit is specifically used to call a target decompression algorithm corresponding to the decompression algorithm identifier, and the target decompression algorithm is multiple preset One of the decompression algorithms; decompressing the second compressed data through the target decompression algorithm to obtain the second original data.
参考图8,图8为一个实施例中的数据传输装置的结构示意图。在一个实施例中,如图8所示,提供了一种数据传输装置,以该装置应用于图1中的第二终端为例进行说明,包括第二接收模块810、第二发送模块820和第二数据交互模块830,其中:Referring to FIG. 8 , FIG. 8 is a schematic structural diagram of a data transmission device in an embodiment. In one embodiment, as shown in FIG. 8 , a data transmission device is provided. The device is applied to the second terminal in FIG. 1 as an example for illustration, including a second receiving module 810, a second sending module 820 and The second data interaction module 830, wherein:
第二接收模块810,用于接收第一终端发送的请求报文,请求报文携带有压缩标识;第二发送模块820,用于基于请求报文向第一终端反馈响应报文,反馈响应报文用于表示第二终端接收到压缩标识;第二数据交互模块830,用于根据压缩标识,与第一终端进行数据传输报文的交互,数据传输报文携带有压缩数据,压缩数据由第一终端或第二终端对原始数据进行压缩得到。The second receiving module 810 is configured to receive a request message sent by the first terminal, and the request message carries a compression identifier; the second sending module 820 is configured to feed back a response message to the first terminal based on the request message, and feed back the response message The text is used to indicate that the second terminal has received the compressed identifier; the second data interaction module 830 is configured to interact with the first terminal on the data transmission message according to the compressed identifier, the data transmission message carries compressed data, and the compressed data is sent by the first terminal The first terminal or the second terminal compresses the original data.
在一个实施例中,第二数据交互模块830包括:第二压缩算法调用单元,用于调用预设压缩算法;第二压缩单元,用于通过预设压缩算法对第二原始数据进行压缩得到第二压缩数据。In one embodiment, the second data interaction module 830 includes: a second compression algorithm calling unit, configured to call a preset compression algorithm; a second compression unit, configured to compress the second original data through the preset compression algorithm to obtain the first Two compressed data.
在一个实施例中,预设压缩算法为多个,第二压缩算法单元具体用于调用与压缩算法标识对应的目标压缩算法,目标压缩算法为多个预设压缩算法的其中一个;通过目标压缩算法对第二原始数据进行压缩得到第二压缩数据。In one embodiment, there are multiple preset compression algorithms, and the second compression algorithm unit is specifically used to call a target compression algorithm corresponding to the compression algorithm identifier, and the target compression algorithm is one of multiple preset compression algorithms; The algorithm compresses the second original data to obtain the second compressed data.
在一个实施例中,第二数据交互模块830包括:第二解压算法调用单元,用于调用预设解压算法;第二解压单元,用于通过预设解压算法对第一压缩数据进行解压处理得到第一原始数据。In one embodiment, the second data interaction module 830 includes: a second decompression algorithm calling unit, configured to call a preset decompression algorithm; a second decompression unit, configured to decompress the first compressed data through the preset decompression algorithm to obtain first raw data.
在一个实施例中,预设解压算法为多个,第二解压单元具体用于调用与解压算法标识对应的目标解压算法,目标解压算法为多个预设解压算法的其中一个;通过目标解压算法对第一压缩数据进行解压处理得到第一原始数据。In one embodiment, there are multiple preset decompression algorithms, and the second decompression unit is specifically used to call the target decompression algorithm corresponding to the decompression algorithm identification, and the target decompression algorithm is one of the multiple preset decompression algorithms; through the target decompression algorithm Decompressing the first compressed data to obtain the first original data.
上述的数据传输装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的一个或多个处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于一个或多个处理器调用执行以上各个模块对应的操作。Each module in the above-mentioned data transmission device may be fully or partially realized by software, hardware and a combination thereof. The above-mentioned modules can be embedded in or independent of one or more processors in the computer device in the form of hardware, and can also be stored in the memory of the computer device in the form of software, so that one or more processors can call and execute the above The operation corresponding to the module.
在一个实施例中,提供了一种电子设备,包括存储器和一个或多个处理器,存储器中存储有计算机可读指令,该一个或多个处理器执行计算机可读指令时实现上述各方法实施例中的步骤。In one embodiment, an electronic device is provided, including a memory and one or more processors, computer-readable instructions are stored in the memory, and the above-mentioned methods are implemented when the one or more processors execute the computer-readable instructions steps in the example.
参考图9,图9为一个实施例中的电子设备的内部结构示意图。如图9所示,该电子设备包括通过系统总线连接的一个或多个处理器、存储器、通信接口、显示屏和输入装置。其中,该电子设备的处理器用于提供计算和控制能力。该电子设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机可读指令。该内存储器为非易失性存储介质中的操作系统和计算机可读指令的运行提供环境。该电子设备的通信接口用于与外部的电子设备进行有线或无线方式的通信,无线方式可通过WIFI、移动蜂窝网络、NFC(近场通信)或其他技术实现。该计算机可读指令被一个或多个处理器执行时以实现一种数据传输方法。该电子设备的显示屏可以是液晶 显示屏或者电子墨水显示屏,该电子设备的输入装置可以是显示屏上覆盖的触摸层,也可以是电子设备外壳上设置的按键、轨迹球或触控板,还可以是外接的键盘、触控板或鼠标等。可选的,本实施例中的第一终端和第二终端均为电子设备。Referring to FIG. 9 , FIG. 9 is a schematic diagram of an internal structure of an electronic device in an embodiment. As shown in FIG. 9, the electronic device includes one or more processors, memory, communication interface, display screen and input device connected through a system bus. Wherein, the processor of the electronic device is used to provide calculation and control capabilities. The memory of the electronic device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and computer readable instructions. The internal memory provides an environment for the execution of the operating system and computer readable instructions in the non-volatile storage medium. The communication interface of the electronic device is used for wired or wireless communication with external electronic devices, and the wireless method can be realized through WIFI, mobile cellular network, NFC (Near Field Communication) or other technologies. The computer readable instructions implement a data transmission method when executed by one or more processors. The display screen of the electronic device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic device may be a touch layer covered on the display screen, or a button, a trackball or a touch pad provided on the housing of the electronic device , and can also be an external keyboard, touchpad, or mouse. Optionally, both the first terminal and the second terminal in this embodiment are electronic devices.
本领域技术人员可以理解,图9中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的电子设备的限定,具体的电子设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 9 is only a block diagram of a part of the structure related to the solution of this application, and does not constitute a limitation on the electronic equipment to which the solution of this application is applied. The specific electronic equipment can be More or fewer components than shown in the figures may be included, or some components may be combined, or have a different arrangement of components.
本领域技术人员可以理解,电子设备可以是无线通信模组,或是包含了无线通信模组的智能设备(如智能汽车、智能柜、智能仪表等),或是手机、电脑、平板等通信设备。Those skilled in the art can understand that the electronic device can be a wireless communication module, or a smart device including a wireless communication module (such as a smart car, a smart cabinet, a smart meter, etc.), or a communication device such as a mobile phone, a computer, or a tablet. .
在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机可读指令,计算机可读指令被一个或多个处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by one or more processors, the steps in the foregoing method embodiments are implemented.
在一个实施例中,还提供了一种数据传输系统,包括第一终端和第二终端。其中,第一终端和第二终端执行的步骤可以参考上述任一实施例的描述,本实施例不作赘述。In one embodiment, a data transmission system is also provided, including a first terminal and a second terminal. For the steps performed by the first terminal and the second terminal, reference may be made to the description of any of the foregoing embodiments, and details are not described in this embodiment.
在一个实施例中,还提供了一种计算机程序产品,包括计算机可读指令,该计算机可读指令被一个或多个处理器执行时实现上述的方法的步骤。In one embodiment, a computer program product is also provided, including computer readable instructions, which implement the steps of the above method when executed by one or more processors.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,的计算机可读指令可存储于一非易失性计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic Random Access Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处 理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的压缩数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above-mentioned embodiments can be completed by instructing related hardware through computer-readable instructions, and the computer-readable instructions can be stored in a non-volatile computer-readable When the computer-readable instructions are executed, the computer-readable instructions may include the processes of the embodiments of the above-mentioned methods. Wherein, any reference to storage, database or other media used in the various embodiments provided in the present application may include at least one of non-volatile and volatile storage. Non-volatile memory can include read-only memory (Read-Only Memory, ROM), tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive variable memory (ReRAM), magnetic variable memory (Magnetoresistive Random Access Memory, MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (Phase Change Memory, PCM), graphene memory, etc. The volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a blockchain-based distributed database, etc., but is not limited thereto. The processors involved in the various embodiments provided by this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, compressed data processing logic devices based on quantum computing, etc. limited to this.
以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. To make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be It is considered to be within the range described in this specification.
以上实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above examples only express several implementation modes of the present application, and the description thereof is relatively specific and detailed, but should not be construed as limiting the patent scope of the present application. It should be noted that those skilled in the art can make several modifications and improvements without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the present application should be determined by the appended claims.

Claims (13)

  1. 一种数据传输方法,应用于第一终端,所述方法包括:A data transmission method applied to a first terminal, the method comprising:
    向第二终端发送请求报文,所述请求报文携带有压缩标识;sending a request message to the second terminal, the request message carrying a compression identifier;
    接收所述第二终端基于所述请求报文反馈的响应报文,所述响应报文用于表示所述第二终端接收到所述压缩标识;receiving a response message fed back by the second terminal based on the request message, where the response message is used to indicate that the second terminal has received the compression identifier;
    根据所述压缩标识,与所述第二终端进行数据传输报文的交互,所述数据传输报文携带有压缩数据,所述压缩数据由所述第一终端和所述第二终端中任意一个对原始数据进行压缩得到。According to the compression identifier, interact with the second terminal in a data transmission message, the data transmission message carries compressed data, and the compressed data is sent by any one of the first terminal and the second terminal obtained by compressing the original data.
  2. 根据权利要求1所述的方法,所述与所述第二终端进行数据传输报文的交互,具体包括:According to the method according to claim 1, the interaction of the data transmission message with the second terminal specifically includes:
    在向所述第二终端发送第一数据传输报文的情况下,对第一原始数据进行压缩处理,得到第一压缩数据,并将所述第一压缩数据填充至所述第一数据传输报文,将填充后的所述第一数据传输报文发送至所述第二终端。In the case of sending the first data transmission message to the second terminal, performing compression processing on the first original data to obtain first compressed data, and filling the first compressed data into the first data transmission message sending the filled first data transmission message to the second terminal.
  3. 根据权利要求2所述的方法,所述对第一原始数据进行压缩处到第一压缩数据,包括:The method according to claim 2, said compressing the first original data to the first compressed data, comprising:
    调用预设压缩算法;Call the preset compression algorithm;
    通过所述预设压缩算法对所述第一原始数据进行压缩得到所述第一压缩数据。The first compressed data is obtained by compressing the first original data by using the preset compression algorithm.
  4. 根据权利要求3所述的方法,所述预设压缩算法为多个,所述请求报文还携带有压缩算法标识,According to the method according to claim 3, there are multiple preset compression algorithms, and the request message also carries a compression algorithm identifier,
    所述调用预设压缩算法包括:The calling preset compression algorithm includes:
    从多个预设压缩算法中,调用与所述压缩算法标识对应的目标压缩算法;calling a target compression algorithm corresponding to the compression algorithm identifier from a plurality of preset compression algorithms;
    所述通过所述预设压缩算法对所述第一原始数据进行压缩得到所述第一压缩数据,包括:The compressing the first original data through the preset compression algorithm to obtain the first compressed data includes:
    通过所述目标压缩算法对所述第一原始数据进行压缩得到所述第一压缩数据。Compressing the first original data by using the target compression algorithm to obtain the first compressed data.
  5. 根据权利要求1所述的方法,所述与所述第二终端进行数据传输报文的交互,具体包括:According to the method according to claim 1, the interaction of the data transmission message with the second terminal specifically includes:
    在接收到所述第二终端发送的第二数据传输报文的情况下,获取所述第二数据传输报文携带的第二压缩数据,并对所述第二压缩数据进行解压处理得到第二原始数据。In the case of receiving the second data transmission message sent by the second terminal, obtain the second compressed data carried in the second data transmission message, and decompress the second compressed data to obtain the second Raw data.
  6. 根据权利要求5所述的方法,The method according to claim 5,
    所述对所述第二压缩数据进行解压处理得到第二原始数据,包括:The decompressing the second compressed data to obtain the second original data includes:
    调用预设解压算法;Call the preset decompression algorithm;
    通过所述预设解压算法对所述第二压缩数据进行解压处理得到 所述第二原始数据。Decompressing the second compressed data through the preset decompression algorithm to obtain the second original data.
  7. 根据权利要求6所述的方法,The method of claim 6,
    所述预设解压算法为多个,所述请求报文还携带有解压算法标识;There are multiple preset decompression algorithms, and the request message also carries a decompression algorithm identifier;
    所述调用预设解压算法包括:The calling preset decompression algorithm includes:
    从多个预设解压算法中,调用与所述解压算法标识对应的目标解压算法;calling a target decompression algorithm corresponding to the decompression algorithm identifier from a plurality of preset decompression algorithms;
    所述通过所述预设解压算法对所述第二压缩数据进行解压处理得到所述第二原始数据,包括:The decompressing the second compressed data through the preset decompression algorithm to obtain the second original data includes:
    通过所述目标解压算法对所述第二压缩数据进行解压处理得到所述第二原始数据。Decompressing the second compressed data by using the target decompression algorithm to obtain the second original data.
  8. 根据权利要求1-7任一项所述的方法,所述请求报文包括以下至少一种:According to the method according to any one of claims 1-7, the request message includes at least one of the following:
    所述第一终端与所述第二终端建立连接时发送的连接请求报文;A connection request message sent when the first terminal establishes a connection with the second terminal;
    所述第一终端与所述第二终端建立连接完成后发送的报文。A message sent by the first terminal after establishing a connection with the second terminal.
  9. 根据权利要求8所述的方法,所述压缩标识配置在所述连接请求报文的连接标志字段。According to the method according to claim 8, the compression identifier is configured in the connection flag field of the connection request message.
  10. 一种数据传输方法,应用于第二终端,所述方法包括:A data transmission method applied to a second terminal, the method comprising:
    接收第一终端发送的请求报文,所述请求报文携带有压缩标识;receiving a request message sent by the first terminal, where the request message carries a compression identifier;
    基于所述请求报文向所述第一终端反馈响应报文,所述响应报文用于表示所述第二终端接收到所述压缩标识;Feedback a response message to the first terminal based on the request message, where the response message is used to indicate that the second terminal has received the compression identifier;
    根据所述压缩标识,与所述第一终端进行数据传输报文的交互,所述数据传输报文携带有压缩数据,所述压缩数据由所述第一终端和所述第二终端中的任意一个对原始数据进行压缩得到。According to the compression identifier, interact with the first terminal in a data transmission message, the data transmission message carries compressed data, and the compressed data is sent by any of the first terminal and the second terminal One is obtained by compressing the original data.
  11. 一种数据传输装置,应用于第一终端,所述装置包括:A data transmission device applied to a first terminal, the device comprising:
    第一发送模块,用于向第二终端发送请求报文,所述请求报文携带有压缩标识;The first sending module is configured to send a request message to the second terminal, the request message carrying a compression identifier;
    第一接收模块,用于接收所述第二终端基于所述请求报文反馈的响应报文,所述响应报文用于表示所述第二终端接收到所述压缩标识;A first receiving module, configured to receive a response message fed back by the second terminal based on the request message, where the response message is used to indicate that the second terminal has received the compression identifier;
    第一数据交互模块,用于根据所述压缩标识,与所述第二终端进行数据传输报文的交互,所述数据传输报文携带有压缩数据,所述压缩数据由所述第一终端和所述第二终端中的任意一个对原始数据进行压缩得到。The first data interaction module is configured to interact with the second terminal with a data transmission message according to the compression identifier, the data transmission message carries compressed data, and the compressed data is shared by the first terminal and the second terminal. Any one of the second terminals compresses the original data.
  12. 一种电子设备,包括存储器和一个或多个处理器,所述存储器存储有计算机可读指令,所述一个或多个处理器执行所述计算机可读指令时实现权利要求1至10中任一项所述的方法的步骤。An electronic device comprising a memory and one or more processors, the memory stores computer-readable instructions, and the one or more processors implement any one of claims 1 to 10 when executing the computer-readable instructions The steps of the method described in the item.
  13. 一个或多个计算机可读存储介质,其上存储有计算机可读指令,所述计算机可读指令被一个或多个处理器执行时实现权利要求1至10中任一项所述的方法的步骤。One or more computer-readable storage media, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by one or more processors, the steps of the method according to any one of claims 1 to 10 are implemented .
PCT/CN2022/103672 2021-12-29 2022-07-04 Data transmission method and apparatus, electronic device, and storage medium WO2023123991A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202111641236.X 2021-12-29
CN202111641236.XA CN114500668A (en) 2021-12-29 2021-12-29 Data transmission method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
WO2023123991A1 true WO2023123991A1 (en) 2023-07-06

Family

ID=81508245

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2022/103672 WO2023123991A1 (en) 2021-12-29 2022-07-04 Data transmission method and apparatus, electronic device, and storage medium

Country Status (2)

Country Link
CN (1) CN114500668A (en)
WO (1) WO2023123991A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500668A (en) * 2021-12-29 2022-05-13 深圳市广和通无线股份有限公司 Data transmission method and device, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102118791A (en) * 2009-12-31 2011-07-06 华为技术有限公司 Method and device for transmitting data packets
CN102333345A (en) * 2011-09-21 2012-01-25 杭州华三通信技术有限公司 Data compressing and transmitting method based on WLAN (wireless local area network), STA (static timing analyzer) and AP (access point)
CN111385268A (en) * 2018-12-29 2020-07-07 电信科学技术研究院有限公司 Data packet header compression confirmation method and communication equipment
CN114500668A (en) * 2021-12-29 2022-05-13 深圳市广和通无线股份有限公司 Data transmission method and device, electronic equipment and storage medium

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111510419B (en) * 2019-01-31 2021-03-30 华为技术有限公司 Data compression method and base station
CN110430168A (en) * 2019-07-05 2019-11-08 视联动力信息技术股份有限公司 A kind of method and apparatus of data compression
CN112887429A (en) * 2021-03-08 2021-06-01 深圳市车宝信息科技有限公司 Data transmission method and device, electronic equipment and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102118791A (en) * 2009-12-31 2011-07-06 华为技术有限公司 Method and device for transmitting data packets
CN102333345A (en) * 2011-09-21 2012-01-25 杭州华三通信技术有限公司 Data compressing and transmitting method based on WLAN (wireless local area network), STA (static timing analyzer) and AP (access point)
CN111385268A (en) * 2018-12-29 2020-07-07 电信科学技术研究院有限公司 Data packet header compression confirmation method and communication equipment
CN114500668A (en) * 2021-12-29 2022-05-13 深圳市广和通无线股份有限公司 Data transmission method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN114500668A (en) 2022-05-13

Similar Documents

Publication Publication Date Title
EP2739073B1 (en) Wireless network, implementation method thereof, and terminal
WO2023123991A1 (en) Data transmission method and apparatus, electronic device, and storage medium
JP2019153333A (en) Systems and methods for transforming sparse elements to dense matrix
US11893963B2 (en) Wireless programmable media processing system
US20100146112A1 (en) Efficient communication techniques
CN110781150A (en) Data transmission method and device and electronic equipment
CN111338780B (en) Transmission method and device for concurrent files
WO2015120736A1 (en) Smart device for realizing multiple-device collaboration and working method for multiple-device collaboration
WO2022028484A1 (en) File sharing method, apparatus, and system
CN111427693B (en) Data processing method, system, medium, service system and bypass unloading system
CN113126985B (en) Method, apparatus, electronic device and computer readable medium for page rendering
CN116561202A (en) Method and device for serializing object
US20140056309A1 (en) Method and apparatus for frame transfer using virtual buffer
EP2726995B1 (en) Methods, apparatuses and computer program products for improving network transmission by reducing memory copy overhead by providing direct access to data
CN112732457A (en) Image transmission method, image transmission device, electronic equipment and computer readable medium
CN113542335A (en) Information sharing method and device, electronic equipment and storage medium
US11770434B1 (en) Compression on-demand in a stream data platform
CN113157365B (en) Program running method, program running device, electronic equipment and computer readable medium
CN113301104B (en) Data processing system and method
CN117749817A (en) Data synchronization method, device, computer equipment and storage medium
CN113342837B (en) Data transmission method, device, electronic equipment and computer readable medium
WO2024045177A1 (en) Data message transmission method, communication apparatus and communication system
WO2024065803A1 (en) Data compression transmission method, apparatus, device, and storage medium
US20230273802A1 (en) Interface display method and apparatus, and electronic device and medium
WO2023283949A1 (en) Communication method and apparatus, electronic device and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 22913280

Country of ref document: EP

Kind code of ref document: A1