Method and apparatus for reading data of protocol stack of transmission control protocol/internet protocol

A technology of transmission control protocol and Internet Protocol, which is applied in the field of communication, can solve problems such as low ability, time-consuming, multi-central processing units, etc., to reduce the number of system calls, reduce the time occupied by system calls, and improve network input and output effect of ability

Inactive Publication Date: 2009-07-29
SHENZHEN COSHIP ELECTRONICS CO LTD
View PDF0 Cites 9 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The inventor finds in the process of realizing the present invention: each system call all needs to expend certain time; A system call also can carry out a data to move from kernel state to user state, has spent more central processing unit (central processing unit, CPU) calculation time, resulting in low network input and output (Input / Output, I / O) capabilities

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and apparatus for reading data of protocol stack of transmission control protocol/internet protocol
  • Method and apparatus for reading data of protocol stack of transmission control protocol/internet protocol
  • Method and apparatus for reading data of protocol stack of transmission control protocol/internet protocol

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0037] Embodiment one, such as figure 1 As shown, a method for reading data by a transmission control protocol / internet protocol protocol stack provided by an embodiment of the present invention includes:

[0038] Step 101: Obtaining an identifier; the identifier specifies reading a plurality of User Datagram Protocol UDP packets in the protocol stack of Transmission Control Protocol / Internet Protocol TCP / IP;

[0039] Step 102: Get the length; the length specifies the total length of the UDP packet to be read

[0040] Step 103: read the corresponding number of UDP packets from the protocol stack according to the total length of the specified UDP packets;

[0041] Step 104: Copy the above number of UDP data packets to the user mode.

[0042] Specify to read multiple UDP packets by identification, and specify the number of UDP packets that can be read by length, so that multiple UDP packets can be read at one time; when reading the same number of UDP packets, the system is red...

Embodiment 2

[0055] Embodiment 2. This embodiment will describe in more detail the implementation idea of ​​Embodiment 1. This embodiment will take the linux-2.6.15 kernel as an example for the application environment of the embodiment of the present invention. It can be understood that this The embodiment of the invention can also be used in other environments, and the above-mentioned linux-2.6.15 kernel should not be construed as a limitation to the embodiment of the invention. like figure 2 shown, including the following steps:

[0056]Step 201: the application program uses the system call function to receive the UDP data packet from the UDP socket;

[0057] The above system call function can be: recv(), recvfrom() or recvmsg();

[0058] The functions of recv, recvfrom or recvmsg in the receiving process of UDP data packets are: to receive a UDP data packet from the socket corresponding to the UDP port, the difference is that the input parameters are different, such as:

[0059] ssi...

Embodiment 3

[0085] Embodiment three, such as Figure 4 As shown, the embodiment of the present invention also provides a data reading device, including:

[0086] The identification obtaining unit 401 is used to obtain the identification; the identification specifies to read multiple User Datagram Protocol UDP packets in the protocol stack of the Transmission Control Protocol / Internet Protocol TCP / IP;

[0087] The length obtaining unit 402 is used for obtaining the length; the length has specified the total length of the UDP packet to be read

[0088] A reading unit 403, configured to read a corresponding number of UDP packets from the protocol stack according to the total length of the specified UDP packets;

[0089] The copying unit 404 is configured to copy the aforementioned number of UDP data packets to the user state.

[0090] The reading unit 403 is further configured to read a UDP data packet from the protocol stack when the identification obtaining unit 401 does not obtain the i...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The embodiment of the invention discloses a protocol stack data reading method and device based on transmission control protocol / Internet Protocol (TCP / IP). The method includes: acquiring identification which designates to read a plurality of User Datagram Protocol (UDP) packets in the TCP / IP protocol stack; acquiring length which designates the total length of the UDP packets to be read; acquiring data, reading the corresponding number of UDP packets form the protocol stack based on the designated total length of the UDP packets; copying these UDP packets to a user state. a plurality of UDP packets are destined to read by identification, the number of UDP packets can be read is destined by the length, so that a plurality of UDP packets can be read at one time; the system invoking number is diminished and the occupation time of system invoking is reduced while reading the same number of UDP packets, thereby enhancing the network input and output capacity.

Description

technical field [0001] The invention relates to the technical field of communication, in particular to a method and a device for reading data by a transmission control protocol / internet protocol protocol stack. Background technique [0002] In network programming, it is sometimes necessary to read User Datagram Protocol (UDP) packets from the protocol stack of Transmission Control Protocol / Internet Protocol (TCP / IP). [0003] The technical solution for extracting UDP data packets in the prior art can be as follows: first, the receiver of the data and the sender negotiate the format of the UDP data packet load and the port for receiving the UDP data packets; the receiver uses the bind function to specify the above-mentioned negotiation A good port receives UDP data packets, and the receiver monitors the above-mentioned port receiving UDP data packets through the system call recv(), recvfrom() or recvmsg() function; then, the sender sends data packets to the receiver, and the ...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): H04L29/08H04L12/56
CPCH04L69/165H04L69/24H04L69/163H04L29/06537H04L29/06115H04L29/06129
Inventor 刘凡
Owner SHENZHEN COSHIP ELECTRONICS CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products