Method for transmitting data, process method for receiving data and device
A technology for sending data and data, applied in the field of communication, can solve the problems that communication cannot actively notify communication, there is no solution, cannot reliably transmit data with order and structure information, etc., to achieve reliable transmission and overcome sticky packets.
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
Example Embodiment
[0037] Example 1
[0038] This embodiment provides a method for sending data, see figure 1 , The flow chart of the method for sending data provided in this embodiment, the method includes:
[0039] Step S102: Determine the data structure corresponding to the data to be sent;
[0040] In this embodiment, the corresponding data structure is defined in advance according to the type of data to be sent, and the data length in different data structures may be different; when data is to be sent, the data structure corresponding to the data to be sent currently is determined according to the definition;
[0041] Step S104: Determine the command type and data length according to the above data structure;
[0042] Step S106: When sending the data in the above data structure for the first time, store the current data according to the specified data packet format, and send the current data in TCP mode;
[0043] The specified data packet format is shown in Table 1, including a command packet header a...
Example Embodiment
[0049] Example 2
[0050] This embodiment also provides a method for processing received data, which is based on the method for sending data provided in Embodiment 1, see figure 2 , The flow chart of the method for processing received data provided by this embodiment, the method includes:
[0051] Step 202: Buffer the data in the received data packet into the buffer; the data packet includes a command packet header, where the command packet header carries the command type and data length;
[0052] If the command packet header is not included in the received data packet, directly buffer it into the buffer;
[0053] Step 204: packetize the data in the buffer according to the foregoing data length;
[0054] Since the application does not set the TCP_NODELAY attribute for TCP, when transmitting data in TCP mode, in order to improve the transmission efficiency, the sender often has to collect enough data before sending a packet of data. If the data sent several times in a row is very small,...
Example Embodiment
[0064] Example 3
[0065] This embodiment provides a method for sending data, which is similar to that in Embodiment 1. figure 1 The difference between the methods shown is that when sending data in this embodiment, the command header also carries a command header flag to indicate whether the receiver should buffer the currently sent data.
[0066] When the data that needs to be sent is ordinary data, for example, when the data that needs to be sent is continuous stream data without structure (such as: files), the receiver does not need to sub-package these data, so there is no need to deal with these data. After receiving the data, the data can be processed according to the usual processing method. For this reason, this embodiment carries a command header flag in the command packet header to indicate whether the receiver should buffer the current data, for example, the pre-agreed command The header flag is 1, which means that the current data needs to be cached. It is agreed in ad...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic.
© 2023 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap