CN113438241A - Data transmission method and system - Google Patents

Data transmission method and system Download PDF

Info

Publication number
CN113438241A
CN113438241A CN202110712792.5A CN202110712792A CN113438241A CN 113438241 A CN113438241 A CN 113438241A CN 202110712792 A CN202110712792 A CN 202110712792A CN 113438241 A CN113438241 A CN 113438241A
Authority
CN
China
Prior art keywords
data
memory
annular
receiving end
annular memory
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.)
Granted
Application number
CN202110712792.5A
Other languages
Chinese (zh)
Other versions
CN113438241B (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.)
Jiayuan Technology Co Ltd
Original Assignee
Jiayuan Technology 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 Jiayuan Technology Co Ltd filed Critical Jiayuan Technology Co Ltd
Priority to CN202110712792.5A priority Critical patent/CN113438241B/en
Publication of CN113438241A publication Critical patent/CN113438241A/en
Application granted granted Critical
Publication of CN113438241B publication Critical patent/CN113438241B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms
    • 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/30Definitions, standards or architectural aspects of layered protocol stacks
    • H04L69/32Architecture of open systems interconnection [OSI] 7-layer type protocol stacks, e.g. the interfaces between the data link level and the physical level
    • H04L69/321Interlayer communication protocols or service data unit [SDU] definitions; Interfaces between layers

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)

Abstract

The embodiment of the invention relates to the field of data transmission, and particularly discloses a method and a system for realizing data transmission. According to the method and the device, the socket protocol family is set, so that data can be directly received and sent in the link layer, and data do not need to be transmitted layer by layer through the data link layer, the network layer, the transmission layer, the session layer, the presentation layer and the application layer, so that a large amount of consumption of system resources caused by data transmission layer by layer is avoided, and meanwhile, the risk of system collapse caused by memory overflow caused by data sending is also avoided; meanwhile, by arranging the annular memory of the sending end, the annular memory of the receiving end, the annular memory of the message confirmation data of the receiving end and the annular memory of the message confirmation data of the sending end, the stability and the accuracy of data sending and receiving are further improved.

Description

Data transmission method and system
Technical Field
The invention belongs to the field of data transmission, and particularly discloses a data transmission method and a data transmission system.
Background
Because the internet can exchange information without being limited by space, people have shadows everywhere in life and work, the importance of the internet is increasing, and data transmission is the most basic and important part for realizing information interaction.
In the prior art, a socket data transmission method is often adopted to transmit data, and the existing socket data transmission method mainly transmits data layer by layer through a data link layer, a network layer, a transmission layer, a session layer, a presentation layer and an application layer, and the adoption of layer-by-layer data transmission can cause a large amount of consumption of system resources, and meanwhile, a large amount of data transmission causes memory overflow, thereby causing the risk of system breakdown.
Disclosure of Invention
In order to solve the above problem, the present application provides a data transmission method, which specifically includes:
s1, acquiring data and data parameters, and distributing the memory size of the annular memory of the sending terminal according to the data parameters;
s2, writing the data into the sending end annular memory, circularly reading the data in the sending end annular memory by the sending end message confirmation data annular memory, and sending the data to the receiving end message confirmation data annular memory;
and S3, circularly storing the data into the receiving end annular memory by the receiving end message confirmation data annular memory, and circularly reading the data in the receiving end annular memory by a receiving end application program.
Further, the S1 specifically includes:
the data parameters include data structure, size of used memory blocks, and number of practical memory blocks.
Further, the S2 specifically includes:
s21: setting a socket protocol family, and writing data into the sending end annular memory of the link layer;
s22: and the sending end message confirms that the annular data storage circularly reads the data in the annular sending end storage, and judges whether the annular sending end storage has the data.
Further, the S22 specifically includes:
if yes, calling a socket to send the data to a receiving end message confirmation data annular memory;
if not, the sending end message confirms that the data ring memory is in a waiting state.
Further, the S3 specifically includes:
s31: calling a socket to receive data;
s32: the receiving end message confirms the data annular memory and judges whether the data in the transmitting end annular memory is received or not;
if yes, circularly storing the data in the sending end annular memory to a receiving end annular memory, and circularly reading the data in the receiving end annular memory by an application program;
if not, the receiving end message confirms that the data ring memory is in a waiting state.
A data transmission system is used for realizing the data transmission method.
Compared with the prior art, the beneficial effects of the method are detailed as follows: by setting the socket protocol family, the method and the device realize the transmission of data between link layers, avoid the large consumption of system resources caused by transmitting data layer by layer, and also avoid the risk of system crash caused by memory overflow caused by data transmission; meanwhile, by arranging the annular memory of the sending end, the annular memory of the receiving end, the annular memory of the message confirmation data of the receiving end and the annular memory of the message confirmation data of the sending end, the stability and the accuracy of data sending and receiving are further improved.
Drawings
Fig. 1 is a schematic flowchart of a method for implementing data transmission according to an embodiment of the present invention;
Detailed Description
In order to make the technical solutions of the present invention better understood by those skilled in the art, the present invention will be further described in detail with reference to the accompanying drawings and specific embodiments.
As shown in fig. 1, an embodiment of the present invention provides a data transmission method, which is applied to a data transmission system, where the system includes a ring memory of a sending end, a ring memory of a receiving end, a ring memory of message acknowledgment data of the receiving end, and a ring memory of message acknowledgment data of the sending end, and the specific method includes:
s1, acquiring data and data parameters, and distributing the memory size of the annular memory of the sending terminal according to the data parameters;
s2, writing the data into the sending end annular memory, circularly reading the data in the sending end annular memory by the sending end message confirmation data annular memory, and sending the data to the receiving end message confirmation data annular memory;
and S3, circularly storing the data into the receiving end annular memory by the receiving end message confirmation data annular memory, and circularly reading the data in the receiving end annular memory by a receiving end application program.
The annular memory is a fixed memory space, a user puts data into the annular memory one by one, and moves the write pointer backwards until the difference value between the write pointer and the read pointer is zero, the annular memory is filled with the data, and the write data is in a waiting state. When a user reads the data of the annular memory, the reading pointer moves backwards when reading one piece of data until the reading pointer is equal, no data can be read, and the read data is in a waiting state.
Therefore, in order to maximize the storage efficiency of the annular memory, the data needs to be analyzed according to the parameters of the data, and then the memory size of the annular memory needs to be allocated according to the result of the data analysis.
As shown in fig. 1, other application programs at the sending end first generate data, and allocate the size of the memory of the ring memory at the sending end according to the data parameters, where the data parameters include a data structure, the size of the used memory blocks, and the number of the practical memory blocks; setting a socket protocol family, storing the data into an annular memory of a link layer sending end according to the size of a distributed memory, circularly reading the data in the annular memory by a sending end message confirmation data annular memory, judging whether the annular memory of the sending end has the data or not, and circularly reading and judging the annular memory of the sending end, wherein the circular reading and judging are carried out on the annular memory of the sending end, and the circular reading and judging are used for preventing the condition that the data is missed to be sent, and if the data is read, the socket is called to send the data to a receiving end message confirmation data annular memory; and if the data is not read, the sending end message confirms that the annular data storage is in a waiting state, and the sending end message confirms that the annular data storage continues to perform the next cycle reading judgment.
The set socket protocol family is specifically a protocol that sets the protocol family of the socket to be PF _ PACKET, sets the socket _ type to be socket _ RAW, and enables data to be directly received and sent at a link layer without passing through a higher layer of the link layer by using a standard physical layer address structure socket addr _ ll that is independent of devices.
At a receiving end, calling a socket to receive data of a transmitting end annular memory, and determining whether the data in the transmitting end annular memory is received or not by the receiving end message confirmation data annular memory; if the judgment result is that the data are stored, circularly storing the data in the sending end annular memory to a receiving end annular memory, and circularly reading the data in the receiving end annular memory by an application program; if the judgment result is that no data exists, the receiving end message confirms that the data annular memory is in a waiting state.
A data transmission system, configured to implement the data transmission method, the specific implementation process of which is described above and is not described herein again.
It should be noted that, in the present specification, each embodiment is described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments may be referred to each other.
It is further noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the same element.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (6)

1. A method of data transmission, the method comprising:
s1, acquiring data and data parameters, and distributing the memory size of the annular memory of the sending terminal according to the data parameters;
s2, writing the data into the sending end annular memory, circularly reading the data in the sending end annular memory by the sending end message confirmation data annular memory, and sending the data to the receiving end message confirmation data annular memory;
and S3, circularly storing the data into the receiving end annular memory by the receiving end message confirmation data annular memory, and circularly reading the data in the receiving end annular memory by a receiving end application program.
2. The data transmission method according to claim 1, wherein the S1 specifically is:
the data parameters include data structure, size of used memory blocks, and number of practical memory blocks.
3. The data transmission method according to claim 1, wherein the S2 specifically is:
s21: setting a socket protocol family, and writing data into the sending end annular memory of the link layer;
s22: and the sending end message confirms that the annular data storage circularly reads the data in the annular sending end storage, and judges whether the annular sending end storage has the data.
4. The data transmission method according to claim 3, wherein the S22 specifically is:
if yes, calling a socket to send the data to a receiving end message confirmation data annular memory;
if not, the sending end message confirms that the data ring memory is in a waiting state.
5. The data transmission method according to claim 1, wherein the S3 specifically is:
s31: calling a socket to receive data;
s32: the receiving end message confirms the data annular memory and judges whether the data in the transmitting end annular memory is received or not;
if yes, circularly storing the data in the sending end annular memory to a receiving end annular memory, and circularly reading the data in the receiving end annular memory by an application program;
if not, the receiving end message confirms that the data ring memory is in a waiting state.
6. A data transmission system for carrying out the data transmission method of any one of claims 1 to 5.
CN202110712792.5A 2021-06-25 2021-06-25 Data transmission method and system Active CN113438241B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110712792.5A CN113438241B (en) 2021-06-25 2021-06-25 Data transmission method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110712792.5A CN113438241B (en) 2021-06-25 2021-06-25 Data transmission method and system

Publications (2)

Publication Number Publication Date
CN113438241A true CN113438241A (en) 2021-09-24
CN113438241B CN113438241B (en) 2024-02-13

Family

ID=77754598

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110712792.5A Active CN113438241B (en) 2021-06-25 2021-06-25 Data transmission method and system

Country Status (1)

Country Link
CN (1) CN113438241B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1129388A1 (en) * 1998-11-09 2001-09-05 Silverbrook Research Pty. Limited Digital camera device with internal printer
CN101729869A (en) * 2009-12-21 2010-06-09 山东大学 Embedded camera video acquisition and network transmission module and working method thereof
CN103617142A (en) * 2013-09-09 2014-03-05 南京邮电大学 High-speed network data collection method based on pf_ring
CN104035884A (en) * 2014-06-30 2014-09-10 河南百旺金赋电脑有限公司 Double-annular-array data storage method and intelligent gateway
WO2018103565A1 (en) * 2016-12-09 2018-06-14 Zhejiang Dahua Technology Co., Ltd. Methods and systems for data transmission
CN109729024A (en) * 2018-12-29 2019-05-07 中盈优创资讯科技有限公司 Data packet handling system and method
CN110418376A (en) * 2019-07-29 2019-11-05 国广东方网络(北京)有限公司 Data transmission method and device
CN111831596A (en) * 2020-07-28 2020-10-27 山东有人信息技术有限公司 RTOS serial port network transmission method and device
CN111988230A (en) * 2020-08-19 2020-11-24 海光信息技术有限公司 Virtual machine communication method, device and system and electronic equipment

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1129388A1 (en) * 1998-11-09 2001-09-05 Silverbrook Research Pty. Limited Digital camera device with internal printer
CN101729869A (en) * 2009-12-21 2010-06-09 山东大学 Embedded camera video acquisition and network transmission module and working method thereof
CN103617142A (en) * 2013-09-09 2014-03-05 南京邮电大学 High-speed network data collection method based on pf_ring
CN104035884A (en) * 2014-06-30 2014-09-10 河南百旺金赋电脑有限公司 Double-annular-array data storage method and intelligent gateway
WO2018103565A1 (en) * 2016-12-09 2018-06-14 Zhejiang Dahua Technology Co., Ltd. Methods and systems for data transmission
CN109729024A (en) * 2018-12-29 2019-05-07 中盈优创资讯科技有限公司 Data packet handling system and method
CN110418376A (en) * 2019-07-29 2019-11-05 国广东方网络(北京)有限公司 Data transmission method and device
CN111831596A (en) * 2020-07-28 2020-10-27 山东有人信息技术有限公司 RTOS serial port network transmission method and device
CN111988230A (en) * 2020-08-19 2020-11-24 海光信息技术有限公司 Virtual machine communication method, device and system and electronic equipment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
刘津铭: ""高速网卡数据传输的研究与实现"", 《中国优秀硕士学位论文信息科技辑》 *
徐路路: ""基于CM平台的网络数据包捕获和解析系统的设计与实现"", 《中国优秀硕士学位论文信息科技辑》 *

Also Published As

Publication number Publication date
CN113438241B (en) 2024-02-13

Similar Documents

Publication Publication Date Title
CN102045772B (en) Data transmission method and device
CN111263338B (en) Network distribution method of Bluetooth Mesh network, related network distribution equipment and system
WO2018214911A1 (en) Data transmission method and apparatus, and electronic device
JP2020501418A (en) Method and apparatus for obtaining HARQ feedback, and method and apparatus for transmitting HARQ feedback
CN109275197B (en) Communication connection establishing method, base station, terminal and storage medium
CN102752411A (en) Redirection method and device
CN110677684A (en) Video processing method, video access method, distributed storage method and distributed video access system
CN103369034A (en) Method, system and device for sending photos to digital photo frames
CN101753416A (en) Message sending method and device
CN101902398B (en) Method and system for receiving and transmitting data packet
CN103068052A (en) Dynamic configuration method and system of resources and portal server
CN113438241A (en) Data transmission method and system
US9999070B2 (en) Information transmission method and device
CN112422485B (en) Communication method and device of transmission control protocol
CN108920333B (en) Event state monitoring method and event state monitor
CN101466163A (en) Method and system for processing information and relevant equipment
WO2021244548A1 (en) Instant message processing method and device
CN111479307B (en) Data transmission method, device, AP and storage medium
JP2007221522A (en) Polling device, terminal device, polling method and program
CN105191460B (en) Information transmission method, equipment and system
US10849179B1 (en) Mobile network tool
CN103139723A (en) Method and system of processing multimedia message and multimedia information and device
CN102891888B (en) A kind of data access method and relevant device, system
CN110827971A (en) Medical logistics intelligent management system
CN112600765A (en) Method and device for scheduling configuration resources

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