CN111953623A - Data transmission method and system - Google Patents

Data transmission method and system Download PDF

Info

Publication number
CN111953623A
CN111953623A CN202010760292.4A CN202010760292A CN111953623A CN 111953623 A CN111953623 A CN 111953623A CN 202010760292 A CN202010760292 A CN 202010760292A CN 111953623 A CN111953623 A CN 111953623A
Authority
CN
China
Prior art keywords
data
sub
size
packet
party
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.)
Pending
Application number
CN202010760292.4A
Other languages
Chinese (zh)
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.)
Shenzhen Oceanwide Testing And Certification Co ltd
Original Assignee
Shenzhen Oceanwide Testing And Certification Co ltd
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 Shenzhen Oceanwide Testing And Certification Co ltd filed Critical Shenzhen Oceanwide Testing And Certification Co ltd
Priority to CN202010760292.4A priority Critical patent/CN111953623A/en
Publication of CN111953623A publication Critical patent/CN111953623A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9057Arrangements for supporting packet reassembly or resequencing

Abstract

The invention relates to a data transmission method and a system, wherein the method comprises the following steps that under the triggering of a data export request pushed by a data import party, a data export party packs data related to the data export request; further, after the total data packet is obtained by packaging, the data exporting party splits the total data packet into a plurality of sub data packets; further, the data export party packages each sub data packet and transmits the sub data packet back to the data import party after packaging; furthermore, the data importing party decapsulates each received sub data packet, the method utilizes the Ethernet to transmit data, the data is convenient and reliable to import and export, a U disk medium is not needed, the mandatory requirement that a worker must go to the site is avoided, the labor cost is saved, and meanwhile, the verification of the imported data and the exported data is simplified.

Description

Data transmission method and system
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a data transmission method and system.
Background
At present, configuration data and historical data of a fire monitoring and alarming system are mostly imported or exported through a USB flash disk, so that the efficiency is low, particularly under the condition of various devices or data, and the data is not convenient to verify.
Disclosure of Invention
The present invention provides a data transmission method and a data transmission system, which are directed to the above-mentioned drawbacks of the prior art.
The technical scheme adopted by the invention for solving the technical problems is as follows:
on one hand, a data transmission method is provided, wherein the method comprises a main control host and a controlled host which communicate through Ethernet; one of the master host and the controlled host is used as a data export party, and the other is used as a data import party; the method comprises the following steps:
under the trigger of a data export request pushed by a data import party, a data export party packs data associated with the data export request;
after the total data packet is obtained by packaging, a data exporting party splits the total data packet into a plurality of sub data packets;
the data exporting party encapsulates each sub data packet and transmits the encapsulated sub data packet back to the data importing party;
and the data importing party decapsulates the received sub data packets.
On the other hand, a data transmission system is provided, which is based on the above data transmission method, wherein the data transmission system comprises a main control unit and a controlled unit which communicate through the ethernet; one of the master control unit and the controlled unit is used as a data export party, and the other one is used as a data import party; the master control unit and the controlled unit both comprise:
the packaging unit is used for packaging the data related to the data export request under the triggering of the data export request;
the splitting unit is used for splitting the total data packet into a plurality of sub data packets after the total data packet is obtained by packaging;
the packaging unit is used for packaging each sub-data packet;
a back transmission unit, configured to transmit back each sub-data packet;
and the decapsulation unit is used for decapsulating the received sub data packets.
The invention has the beneficial effects that: the Ethernet is used for data transmission, the data is convenient and reliable to import and export, a U disk medium is not needed, the mandatory requirement that a worker must go to the site is avoided, the labor cost is saved, and meanwhile, the verification of the imported data and the exported data is simplified.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the present invention will be further described with reference to the accompanying drawings and embodiments, wherein the drawings in the following description are only part of the embodiments of the present invention, and for those skilled in the art, other drawings can be obtained without inventive efforts according to the accompanying drawings:
fig. 1 is a flowchart illustrating an implementation of a data transmission method according to an embodiment of the present invention; and
fig. 2 is a block diagram of a data transmission system according to a second embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments of the present invention, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without inventive step, are within the scope of the present invention.
Example one
An embodiment of the present invention provides a data transmission method, as shown in fig. 1, including a master host and a controlled host communicating via an ethernet; the system comprises a main control host and a controlled host, wherein one of the main control host and the controlled host is used as a data export party, and the other one is used as a data import party; the method comprises the following steps:
step S1: and under the trigger of the data export request pushed by the data import party, the data export party packages the data associated with the data export request.
Step S2: and after the total data packet is obtained by packaging, the data exporting party splits the total data packet into a plurality of sub data packets.
Step S3: and the data exporting party encapsulates each sub-data packet and transmits the encapsulated sub-data packet back to the data importing party.
Step S4: and the data importing party decapsulates the received sub data packets.
Wherein, adopt the mode of looking over one by one in order to avoid missing data, specific packing step includes:
traversing data stored under a target storage path associated with the data export request;
judging whether the type of the currently accessed data is a folder or a file;
if the folder is the current folder, traversing the content of the current folder, and jumping to the step of judging the category; and if the file is the file, packaging the currently accessed data.
Furthermore, because the capacity of data port for single data transmission is limited, the size of the file needs to be counted to facilitate the subsequent total data packet splitting, and when the data type is a file, the size of the file of the data is counted;
the splitting step comprises:
acquiring the split parts of the total data packet according to a formula N/(8 x 1024-15), wherein N is the split parts, and N is the data length of the total data packet;
and sequentially splitting the total data packet into n sub-data packets, wherein the data lengths of the rest sub-data packets are the same except the tail sub-data packet.
Further, in order to facilitate the user to view the data, data restoration is performed at the data importing party, specifically: each sub-data packet and the data associated with the data export request have unique identifiers for assembling and restoring;
the packing step further comprises:
when the data type is a folder, before contents contained in the current folder are traversed, the sum of subfolders and files contained in the current data, identifications associated with the contents in the current directory and positions corresponding to the identifications are counted;
when the data type is a file, counting the associated identification and the position corresponding to the identification;
after the step of splitting, the method further comprises:
counting the associated identification of the sub-data packet and the position corresponding to the identification;
after the decapsulating step, the method further comprises:
the data importing party assembles and restores the total data packet according to the identifier associated with the sub data packet and the position corresponding to the identifier;
and the data import party assembles and restores the data associated with the data export request according to the total sum, the identification and the position corresponding to the identification counted in the packaging step.
Further, in the encapsulating step, the specific packet encapsulation format includes:
in the header:
the size of the protocol header is 1byte, and is defined as 0x 7E;
the size of the protocol version number is 1byte, and is defined as 1;
the size of the source host number is 1byte, and the source host number is defined as a host number for exporting data;
the size of the source type is 1byte, and the source type is defined as a source host controller type;
the size of the target host is 1byte, and the target host is defined as a host number for importing data;
the size of the target type is 1byte, and the target type is defined as a target host controller type;
the total number of the modules is 2 bytes, and is defined as the split number of the total data packets;
the module serial number is 2 bytes and is defined as the identifier of the sub data packet;
the size of the data length is 2 bytes, and the data length is defined as the actual data length of the sub data packet;
in the data:
actual data is defined as information data;
in the verification:
the CRC check size is 2 bytes, and is defined as checking the full frame data;
in the tail reporting:
the size of the protocol trailer is 2 bytes, defined as 0x 7E.
According to the method provided by the embodiment, the Ethernet is used for data transmission, the data is convenient and reliable to import and export, a U disk medium is not needed, the mandatory requirement that a worker must go to the site is avoided, the labor cost is saved, and meanwhile, the verification of the imported data and the exported data is simplified.
Example two
The embodiment of the invention provides a data transmission system, and a data transmission method based on the first embodiment comprises a main control unit and a controlled unit which are communicated through an Ethernet; the system comprises a main control unit and a controlled unit, wherein one of the main control unit and the controlled unit is used as a data export party, and the other one is used as a data import party; as shown in fig. 2, the master unit and the slave unit each include:
a packing unit 10, configured to pack data associated with a data export request, under the trigger of the data export request;
the splitting unit 11 is configured to split the total data packet into a plurality of sub data packets after the total data packet is obtained by packaging;
a packaging unit 12, configured to package each sub-packet;
a return unit 13, configured to return each sub-packet;
a decapsulation unit 14, configured to decapsulate the received sub data packets;
the counting unit 15 is specifically configured to count identifiers associated with the sub data packets and positions corresponding to the identifiers;
the reduction unit 16 is assembled, in particular for:
assembling and restoring a total data packet according to the identifier associated with the sub-data packet and the position corresponding to the identifier;
and assembling and restoring the data associated with the data export request according to the sum, the identification and the position corresponding to the identification counted in the packaging step.
Wherein, the packing unit is specifically configured to:
traversing data stored under a target storage path associated with the data export request;
judging whether the type of the currently accessed data is a folder or a file;
if the folder is the current folder, traversing the content of the current folder, and jumping to the step of judging the category; and if the file is the file, packaging the currently accessed data.
Further, the packing unit is further specifically configured to: when the data type is a file, counting the file size of the data;
the splitting unit is specifically configured to:
acquiring the split parts of the total data packet according to a formula N/(8 x 1024-15), wherein N is the split parts, and N is the data length of the total data packet;
and sequentially splitting the total data packet into n sub-data packets, wherein the data lengths of the rest sub-data packets are the same except the tail sub-data packet.
Furthermore, each sub-data packet and the data associated with the data export request have unique identifiers for assembling and restoring;
the packing unit is further specifically configured to:
when the data type is a folder, before contents contained in the current folder are traversed, the sum of subfolders and files contained in the current data, identifications associated with the contents in the current directory and positions corresponding to the identifications are counted;
and when the data type is a file, counting the associated identification and the position corresponding to the identification.
Further, the specific packet encapsulation format includes:
in the header:
the size of the protocol header is 1byte, and is defined as 0x 7E;
the size of the protocol version number is 1byte, and is defined as 1;
the size of the source host number is 1byte, and the source host number is defined as a host number for exporting data;
the size of the source type is 1byte, and the source type is defined as a source host controller type;
the size of the target host is 1byte, and the target host is defined as a host number for importing data;
the size of the target type is 1byte, and the target type is defined as a target host controller type;
the total number of the modules is 2 bytes, and is defined as the split number of the total data packets;
the module serial number is 2 bytes and is defined as the identifier of the sub data packet;
the size of the data length is 2 bytes, and the data length is defined as the actual data length of the sub data packet;
in the data:
actual data is defined as information data;
in the verification:
the CRC check size is 2 bytes, and is defined as checking the full frame data;
in the tail reporting:
the size of the protocol trailer is 2 bytes, defined as 0x 7E.
The embodiment utilizes the Ethernet to transmit data, the data is convenient and reliable to import and export, a U disk medium is not needed, the mandatory requirement that a worker must go to the site is avoided, the labor cost is saved, and the verification of the imported data and the exported data is simplified.
It will be understood that modifications and variations can be made by persons skilled in the art in light of the above teachings and all such modifications and variations are intended to be included within the scope of the invention as defined in the appended claims.

Claims (10)

1. A data transmission method is characterized by comprising a main control host and a controlled host which communicate through Ethernet; one of the master host and the controlled host is used as a data export party, and the other is used as a data import party; the method comprises the following steps:
under the trigger of a data export request pushed by a data import party, a data export party packs data associated with the data export request;
after the total data packet is obtained by packaging, a data exporting party splits the total data packet into a plurality of sub data packets;
the data exporting party encapsulates each sub data packet and transmits the encapsulated sub data packet back to the data importing party;
and the data importing party decapsulates the received sub data packets.
2. A data transmission method according to claim 1, wherein the step of packetizing comprises:
traversing data stored under a target storage path associated with the data export request;
judging whether the type of the currently accessed data is a folder or a file;
if the folder is the current folder, traversing the content of the current folder, and jumping to the step of judging the category; and if the file is the file, packaging the currently accessed data.
3. A data transmission method according to claim 2, wherein when the data type is a file, the file size of the data is counted;
the splitting step comprises:
acquiring the split parts of the total data packet according to a formula N/(8 x 1024-15), wherein N is the split parts, and N is the data length of the total data packet;
and sequentially splitting the total data packet into n sub-data packets, wherein the data lengths of the rest sub-data packets are the same except the tail sub-data packet.
4. A data transmission method as claimed in claim 3, wherein each sub-packet and the data associated with the data export request have a unique identifier for assembling the restore;
the packing step further comprises:
when the data type is a folder, before contents contained in the current folder are traversed, the sum of subfolders and files contained in the current data, identifications associated with the contents in the current directory and positions corresponding to the identifications are counted;
when the data type is a file, counting the associated identification and the position corresponding to the identification;
after the step of splitting, the method further comprises:
counting the associated identification of the sub-data packet and the position corresponding to the identification;
after the decapsulating step, the method further comprises:
the data importing party assembles and restores the total data packet according to the identifier associated with the sub data packet and the position corresponding to the identifier;
and the data import party assembles and restores the data associated with the data export request according to the total sum, the identification and the position corresponding to the identification counted in the packaging step.
5. The data transmission method according to claim 4, wherein in the encapsulating step, the specific message encapsulation format includes:
in the header:
the size of the protocol header is 1byte, and is defined as 0x 7E;
the size of the protocol version number is 1byte, and is defined as 1;
the size of the source host number is 1byte, and the source host number is defined as a host number for exporting data;
the size of the source type is 1byte, and the source type is defined as a source host controller type;
the size of the target host is 1byte, and the target host is defined as a host number for importing data;
the size of the target type is 1byte, and the target type is defined as a target host controller type;
the total number of the modules is 2 bytes, and is defined as the split number of the total data packets;
the module serial number is 2 bytes and is defined as the identifier of the sub data packet;
the size of the data length is 2 bytes, and the data length is defined as the actual data length of the sub data packet;
in the data:
actual data is defined as information data;
in the verification:
the CRC check size is 2 bytes, and is defined as checking the full frame data;
in the tail reporting:
the size of the protocol trailer is 2 bytes, defined as 0x 7E.
6. A data transmission system, based on a data transmission method of any one of claims 1 to 5, comprising a master unit and a slave unit communicating via Ethernet; one of the master control unit and the controlled unit is used as a data export party, and the other one is used as a data import party; the master control unit and the controlled unit both comprise:
the packaging unit is used for packaging the data related to the data export request under the triggering of the data export request;
the splitting unit is used for splitting the total data packet into a plurality of sub data packets after the total data packet is obtained by packaging;
the packaging unit is used for packaging each sub-data packet;
a back transmission unit, configured to transmit back each sub-data packet;
and the decapsulation unit is used for decapsulating the received sub data packets.
7. The data transmission system according to claim 6, wherein the packing unit is specifically configured to:
traversing data stored under a target storage path associated with the data export request;
judging whether the type of the currently accessed data is a folder or a file;
if the folder is the current folder, traversing the content of the current folder, and jumping to the step of judging the category; and if the file is the file, packaging the currently accessed data.
8. The data transmission system according to claim 7, wherein the packing unit is further specifically configured to: when the data type is a file, counting the file size of the data;
the splitting unit is specifically configured to:
acquiring the split parts of the total data packet according to a formula N/(8 x 1024-15), wherein N is the split parts, and N is the data length of the total data packet;
and sequentially splitting the total data packet into n sub-data packets, wherein the data lengths of the rest sub-data packets are the same except the tail sub-data packet.
9. A data transmission system as claimed in claim 8, wherein each sub-packet and the data associated with the data export request has a unique identifier for assembling the restore;
the packing unit is further specifically configured to:
when the data type is a folder, before contents contained in the current folder are traversed, the sum of subfolders and files contained in the current data, identifications associated with the contents in the current directory and positions corresponding to the identifications are counted;
when the data type is a file, counting the associated identification and the position corresponding to the identification;
the master control unit and the controlled unit both further comprise:
the statistic unit is specifically used for counting the associated identifiers of the sub-data packets and the positions corresponding to the identifiers;
the assembly reduction unit is specifically configured to:
assembling and restoring a total data packet according to the identifier associated with the sub-data packet and the position corresponding to the identifier;
and assembling and restoring the data associated with the data export request according to the sum, the identification and the position corresponding to the identification counted in the packaging step.
10. The data transmission system of claim 9, wherein the specific packet encapsulation format comprises:
in the header:
the size of the protocol header is 1byte, and is defined as 0x 7E;
the size of the protocol version number is 1byte, and is defined as 1;
the size of the source host number is 1byte, and the source host number is defined as a host number for exporting data;
the size of the source type is 1byte, and the source type is defined as a source host controller type;
the size of the target host is 1byte, and the target host is defined as a host number for importing data;
the size of the target type is 1byte, and the target type is defined as a target host controller type; the total number of the modules is 2 bytes, and is defined as the split number of the total data packets; the module serial number is 2 bytes and is defined as the identifier of the sub data packet;
the size of the data length is 2 bytes, and the data length is defined as the actual data length of the sub data packet; in the data:
actual data is defined as information data;
in the verification:
the CRC check size is 2 bytes, and is defined as checking the full frame data;
in the tail reporting:
the size of the protocol trailer is 2 bytes, defined as 0x 7E.
CN202010760292.4A 2020-07-31 2020-07-31 Data transmission method and system Pending CN111953623A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010760292.4A CN111953623A (en) 2020-07-31 2020-07-31 Data transmission method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010760292.4A CN111953623A (en) 2020-07-31 2020-07-31 Data transmission method and system

Publications (1)

Publication Number Publication Date
CN111953623A true CN111953623A (en) 2020-11-17

Family

ID=73339021

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010760292.4A Pending CN111953623A (en) 2020-07-31 2020-07-31 Data transmission method and system

Country Status (1)

Country Link
CN (1) CN111953623A (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020176362A1 (en) * 2001-03-21 2002-11-28 Lg Electronics Inc. Method for retransmitting data through a reverse link in packet data communication system using automatic repeat request
CN101547161A (en) * 2008-03-28 2009-09-30 阿里巴巴集团控股有限公司 Folder transmission system, folder transmission device and folder transmission method
CN103152421A (en) * 2013-03-12 2013-06-12 中广核检测技术有限公司 Remote and automatic synchronous transmission system and method of eddy-current testing data in nuclear power station
CN103888513A (en) * 2014-02-25 2014-06-25 世纪龙信息网络有限责任公司 Server-side multifile downloading method and system
CN109286641A (en) * 2017-07-19 2019-01-29 腾讯科技(深圳)有限公司 A kind of document transmission method and its device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20020176362A1 (en) * 2001-03-21 2002-11-28 Lg Electronics Inc. Method for retransmitting data through a reverse link in packet data communication system using automatic repeat request
CN101547161A (en) * 2008-03-28 2009-09-30 阿里巴巴集团控股有限公司 Folder transmission system, folder transmission device and folder transmission method
CN103152421A (en) * 2013-03-12 2013-06-12 中广核检测技术有限公司 Remote and automatic synchronous transmission system and method of eddy-current testing data in nuclear power station
CN103888513A (en) * 2014-02-25 2014-06-25 世纪龙信息网络有限责任公司 Server-side multifile downloading method and system
CN109286641A (en) * 2017-07-19 2019-01-29 腾讯科技(深圳)有限公司 A kind of document transmission method and its device

Similar Documents

Publication Publication Date Title
CN102377650B (en) Data transmission processing method, device and system
CN108965484A (en) A kind of transmission method of internet of things data, system and terminal
CN111083161A (en) Data transmission processing method and device and Internet of things equipment
CN112769939B (en) Big data reliable transmission method for real-time communication
RU2011108113A (en) DEVICE AND METHOD FOR FORMING MAS DATA PROTOCOL MODULE IN WIRELESS COMMUNICATION SYSTEM
FR2804816A1 (en) TRANSPORT OF PROTOCOL PORTABLE ELECTRONIC OBJECT PROTOCOL UNITS FOR MICROCOMPUTER DEVICES
CN101459654A (en) Multi-protocol service data package parsing method, receiving terminal and sending terminal
CN101753586A (en) Method for transmitting data, process method for receiving data and device
CN106452688A (en) Beidou data lost message retransmission method and system
JP2015089092A (en) Method of packaging packet, method of unpackaging packet, and apparatuses using the same
FR2901442A1 (en) SECURE FILE TRANSFER METHOD
CN103365810B (en) The method and apparatus that flash memory devices programming time is reduced in C.A.N. buses
WO2021088813A1 (en) Packet encapsulating method and apparatus, and packet decapsulating method and apparatus
CN114120481A (en) CAN data acquisition method, device and system
CN110677354A (en) Message transmission method, terminal and server
CN107483287B (en) System and method for automatically monitoring network port data packet receiving and sending faults
CN110213756A (en) A kind of data transmission method, device and its relevant device
CN101826997A (en) Communication method of newly accessed intelligent equipment, device and monitoring system
CN104580459A (en) Avionics target hardware equipment Ethernet data loading method
CN108632326B (en) Method and device for transmitting data by protocol data unit
CN103746945B (en) A kind of data transmission device and method
CN101667959A (en) Method and device for transmitting data in physical layer and data transmission system
WO2024022022A1 (en) Multi-network card fusion communication method and communication system
CN111953623A (en) Data transmission method and system
CN108429729B (en) Data communication isolation system and isolation method in industrial big data acquisition environment

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
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201117