CN109150406B - Data packet subpackaging method for byte stream communication - Google Patents

Data packet subpackaging method for byte stream communication Download PDF

Info

Publication number
CN109150406B
CN109150406B CN201811097523.7A CN201811097523A CN109150406B CN 109150406 B CN109150406 B CN 109150406B CN 201811097523 A CN201811097523 A CN 201811097523A CN 109150406 B CN109150406 B CN 109150406B
Authority
CN
China
Prior art keywords
byte
bit7
bytes
data
packet header
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201811097523.7A
Other languages
Chinese (zh)
Other versions
CN109150406A (en
Inventor
丁顺敏
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Golden Mask Technology Co.,Ltd.
Original Assignee
Individual
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 Individual filed Critical Individual
Priority to CN201811097523.7A priority Critical patent/CN109150406B/en
Publication of CN109150406A publication Critical patent/CN109150406A/en
Application granted granted Critical
Publication of CN109150406B publication Critical patent/CN109150406B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0001Systems modifying transmission characteristics according to link quality, e.g. power backoff
    • H04L1/0006Systems modifying transmission characteristics according to link quality, e.g. power backoff by adapting the transmission format
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/0078Avoidance of errors by organising the transmitted data in a format specifically designed to deal with errors, e.g. location
    • H04L1/0079Formats for control data
    • 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/22Parsing or analysis of headers

Abstract

A data packet sub-packaging method for byte stream communication belongs to the technical field of communication. The method comprises the following steps: distinguishing a packet header; packing by a sender; and unpacking by a receiver. The method is time-saving and resource-saving.

Description

Data packet subpackaging method for byte stream communication
Technical Field
The invention belongs to the technical field of communication, and particularly relates to a data packet subpackaging method for byte stream communication.
Background
In byte stream communication, the current data packet subpackaging method has the defect of high energy consumption, and is not beneficial to resource saving.
Disclosure of Invention
In order to solve the above problems, the present invention provides a method for packetizing data packets for byte stream communication, the method comprising the steps of: distinguishing a packet header; packing by a sender; and unpacking by a receiver.
Preferably, the sender packing method includes:
the assignment of the 9 th byte of the buffer area is zero, and the bit7 of the 6-byte load (data to be sent) is filled into the bit 0-5 of the 9 th byte of the buffer area;
calculating the XOR check of 6 bytes of source load data, filling bit7 of a check code into bit6 of the 9 th byte of a sending cache, setting the bit7 of the check code to be 0 and filling the bit into the 8 th byte of a cache region;
setting bit7 of 6-byte load to 0 and then sequentially filling the bit7 into 2 nd to 7 th bytes of a buffer area;
and generating a packet header as required and then transmitting the packet header.
Preferably, the unpacking step of the receiving side includes:
step 1: when the byte of bit7 is 1 and the addresses match, the header is considered to be stored in the receiving buffer;
step 2: continuously receiving 8 bytes with bit7 being 0, storing the bytes into a cache, and if the subsequent bytes have bit7 being 1, determining that the communication is faulty and returning to the step 1;
and step 3: restoring the load and the check code by using the 9 th byte, checking the 2 nd to 7 th bytes, and returning to the step 1 if the checking fails; and (5) successfully checking to obtain the instruction of the sender.
The method of the invention can be continuously or discontinuously transmitted without time limitation; because strict time sequence control is not needed, CPU resources such as a timer can be saved; and the bandwidth utilization rate is also improved because the time delay is not needed.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be described in further detail with reference to specific embodiments. It should be understood that the description is intended to be exemplary only, and is not intended to limit the scope of the present invention. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present invention.
The invention provides a data packet subpackaging method for byte stream communication, which comprises the following steps:
distinguishing a packet header; packing by a sender; and unpacking by a receiver.
For example convention (not limited to this approach): fixed-length data packets (9 bytes). It is agreed that the first bit (bit7) of each byte is a header flag bit, 1 indicates a header, and the flag bits of other data are 0.
Figure GDA0003005444690000021
Wrapping head
The first byte is a packet header, and the flag bit is 1; the slave enables: the values 1-4 of bits 0-3 represent drivers 1-4 respectively, 0 represents mass sending, and 5 represents a host; slave reply enable: the values of bits 4-6 indicate that the corresponding driver # 1-4 is allowed to reply to the command, and when equal to 0, no slave replies are allowed (only when the corresponding slave receives the command and the slave reply enable is equal to the slave number).
Payload data
The 2 nd to 7 th bytes are data after the source load data bit7 is set to 0.
Verification
The source payload data is in turn bitwise xored and bit7 is set to 0.
Bit7 of the first 7 bytes
Bit0 is Bit7 of the first byte of the source payload data, and … … through Bit6 in turn are Bit7 of the source parity value.
Specifically, the sender packaging method includes: the assignment of the 9 th byte of the buffer area is zero, and the bit7 of the 6-byte load (data to be sent) is filled into the bit 0-5 of the 9 th byte of the buffer area; calculating the XOR check of 6 bytes of source load data, filling bit7 of a check code into bit6 of the 9 th byte of a sending cache, setting the bit7 of the check code to be 0 and filling the bit into the 8 th byte of a cache region;
setting bit7 of 6-byte load to 0 and then sequentially filling the bit7 into 2 nd to 7 th bytes of a buffer area;
and generating a packet header as required and then transmitting the packet header.
Specifically, the unpacking step of the receiver includes:
step 1: when the byte of bit7 is 1 and the addresses match, the header is considered to be stored in the receiving buffer;
step 2: continuously receiving 8 bytes with bit7 being 0, storing the bytes into a cache, and if the subsequent bytes have bit7 being 1, determining that the communication is faulty and returning to the step 1;
and step 3: restoring the load and the check code by using the 9 th byte, checking the 2 nd to 7 th bytes, and returning to the step 1 if the checking fails; and (5) successfully checking to obtain the instruction of the sender.
It is to be understood that the above-described embodiments of the present invention are merely illustrative of or explaining the principles of the invention and are not to be construed as limiting the invention. Therefore, any modification, equivalent replacement, improvement and the like made without departing from the spirit and scope of the present invention should be included in the protection scope of the present invention. Further, it is intended that the appended claims cover all such variations as fall within the scope and boundaries of the appended claims, or the equivalents of such scope and boundaries.

Claims (1)

1. A method for packetizing data packets for byte stream communication, the method comprising: distinguishing a packet header; packing by a sender; unpacking by a receiver;
a fixed-length data packet with 9 bytes, wherein a first bit7 of each byte is appointed as a header flag bit, 1 represents a packet header, and flag bits of other data are 0;
the sender packaging method comprises the following steps:
the assignment of the 9 th byte of the buffer area is zero, and bit7 of 6 data byte loads to be sent is filled into bit 0-5 of the 9 th byte of the buffer area; calculating the XOR check of 6 bytes of source load data, filling bit7 of a check code into bit6 of the 9 th byte of a sending cache, setting the bit7 of the check code to be 0 and filling the bit into the 8 th byte of a cache region;
setting bit7 of 6-byte load to 0 and then sequentially filling the bit7 into 2 nd to 7 th bytes of a buffer area;
generating a packet header according to the requirement and then sending the packet header;
the unpacking step of the receiver comprises the following steps:
step 1: when the byte of bit7 is 1 and the addresses match, the header is considered to be stored in the receiving buffer;
step 2: continuously receiving 8 bytes with bit7 being 0, storing the bytes into a cache, and if the subsequent bytes have bit7 being 1, determining that the communication is faulty and returning to the step 1;
and step 3: restoring the load and the check code by using the 9 th byte, checking the 2 nd to 7 th bytes, and returning to the step 1 if the checking fails; and (5) successfully checking to obtain the instruction of the sender.
CN201811097523.7A 2018-09-20 2018-09-20 Data packet subpackaging method for byte stream communication Active CN109150406B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811097523.7A CN109150406B (en) 2018-09-20 2018-09-20 Data packet subpackaging method for byte stream communication

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811097523.7A CN109150406B (en) 2018-09-20 2018-09-20 Data packet subpackaging method for byte stream communication

Publications (2)

Publication Number Publication Date
CN109150406A CN109150406A (en) 2019-01-04
CN109150406B true CN109150406B (en) 2021-05-25

Family

ID=64815071

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811097523.7A Active CN109150406B (en) 2018-09-20 2018-09-20 Data packet subpackaging method for byte stream communication

Country Status (1)

Country Link
CN (1) CN109150406B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112511587B (en) * 2020-10-23 2024-02-09 许继集团有限公司 Communication data processing method and device for power distribution network differential service

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7643486B2 (en) * 2000-02-14 2010-01-05 Cisco Technology, Inc. Pipelined packet switching and queuing architecture
CN101877793A (en) * 2009-06-01 2010-11-03 杭州海康威视软件有限公司 Data transmitting method, error detecting method, system thereof and device thereof
CN103763374A (en) * 2014-01-23 2014-04-30 深圳联友科技有限公司 Method and device for data transmission based on UDT
CN106817367A (en) * 2017-01-03 2017-06-09 深圳市沃特玛电池有限公司 A kind of data transmission method and system
CN206254662U (en) * 2016-11-30 2017-06-16 南京富士通电子信息科技股份有限公司 A kind of printer with NFC coils
CN107580768A (en) * 2015-07-17 2018-01-12 华为技术有限公司 The methods, devices and systems of message transmissions

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7643486B2 (en) * 2000-02-14 2010-01-05 Cisco Technology, Inc. Pipelined packet switching and queuing architecture
CN101877793A (en) * 2009-06-01 2010-11-03 杭州海康威视软件有限公司 Data transmitting method, error detecting method, system thereof and device thereof
CN103763374A (en) * 2014-01-23 2014-04-30 深圳联友科技有限公司 Method and device for data transmission based on UDT
CN107580768A (en) * 2015-07-17 2018-01-12 华为技术有限公司 The methods, devices and systems of message transmissions
CN206254662U (en) * 2016-11-30 2017-06-16 南京富士通电子信息科技股份有限公司 A kind of printer with NFC coils
CN106817367A (en) * 2017-01-03 2017-06-09 深圳市沃特玛电池有限公司 A kind of data transmission method and system

Also Published As

Publication number Publication date
CN109150406A (en) 2019-01-04

Similar Documents

Publication Publication Date Title
US10637506B2 (en) Apparatus and method for transmitting/receiving forward error correction packet in mobile communication system
US11412078B2 (en) Data transmission method and first device
CN107079017B (en) Message conversion method and device
ES2533989T3 (en) Media access control layer that encapsulates data, from a plurality of received data units, into a plurality of independently transmissible blocks
US9166917B2 (en) Link layer preemption
JP6656617B2 (en) Method and system for secure communication of control information in a wireless network environment
US20130208630A1 (en) Avionics full-duplex switched ethernet network
WO2017088557A1 (en) Processing method and apparatus for sending and receiving data packet
US8767775B2 (en) Efficient MAC header design and communication using same
CN101388900B (en) Processing method, apparatus and system for protocol data unit filling
JP2022539670A (en) Packet processing method and related device
CN104378315A (en) Method and device for CAPWAP tunnel data package transmission
CN109150406B (en) Data packet subpackaging method for byte stream communication
CN103607264A (en) 3G network-based in-band data transmission method
WO2017045501A1 (en) Packet scheduling method and apparatus, and storage medium
CN113079074A (en) Protocol stack communication method, device and storage medium based on CAN bus
US10785670B2 (en) Packet data converge protocol protocol data unit pre-processing
TWI416898B (en) System and method for data transmission
US20170034067A1 (en) Efficient Datagram Segmentation and Reassembly for Packet-Switched Networks
CN103944880A (en) ZigBee data transmission method
US11196792B2 (en) Method, device and system for transmitting data
WO2019015487A1 (en) Data retransmission method, rlc entity and mac entity
CN115052049A (en) Message forwarding method and system based on IPsec tunnel
CN109462591B (en) Data transmission method, receiving method, device and system
CN113115365A (en) Data packet transmission method based on LoRaWAN communication protocol

Legal Events

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

Effective date of registration: 20231008

Address after: No. 317, 3rd Floor, Building 1, No. 55, Qingheli South Section, Jinjiang District, Chengdu, Sichuan Province, 610000

Patentee after: Chengdu Golden Mask Technology Co.,Ltd.

Address before: Unit 2, building 3, Huanhua community, No.116, West 1st section of 2nd Ring Road, Qingyang District, Chengdu, Sichuan 610000

Patentee before: Ding Shunmin