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
Embodiment 1
[0038] This embodiment provides a method for sending data, see figure 1 , which is a flowchart of a 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 length of data 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] Wherein, the specified data packet format is shown in Table 1, including command header ...
Embodiment 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 , which is a flowchart of a method for processing received data provided in this embodiment, the method includes:
[0051] Step 202: cache the data in the received data packet into a buffer; the data packet includes a command header, wherein the command header carries a command type and a data length;
[0052] If the received data packet does not include the command packet header, directly cache it into the buffer;
[0053]Step 204: Packetize the data in the buffer according to the above data length;
[0054] Since the application program 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 needs to collect enough data before sending a packet of data. If the data sent several times in a row is very little, Usually TCP wi...
Embodiment 3
[0065] This embodiment provides a method for sending data, which is the same as that in Embodiment 1 figure 1 The difference of the shown methods is that in this embodiment, when data is sent, the command header also carries a command header flag, which is used to indicate whether the receiver caches the currently sent data.
[0066] When the data that needs to be sent is ordinary data, for example, when what needs to be sent is continuous stream data without structure (such as: file), the receiver does not need to subpackage the data, so it does not need to process the data After receiving these data, they 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 caches the current data. For example, the pre-agreed command The header flag is 1, which means that the current data needs to be cached, and the pre-agreed command header flag is 0, which mean...
PUM

Abstract
Description
Claims
Application Information

- Generate Ideas
- Intellectual Property
- Life Sciences
- Materials
- Tech Scout
- Unparalleled Data Quality
- Higher Quality Content
- 60% Fewer Hallucinations
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2025 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com