CN112702362B - Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium - Google Patents

Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium Download PDF

Info

Publication number
CN112702362B
CN112702362B CN202110310964.6A CN202110310964A CN112702362B CN 112702362 B CN112702362 B CN 112702362B CN 202110310964 A CN202110310964 A CN 202110310964A CN 112702362 B CN112702362 B CN 112702362B
Authority
CN
China
Prior art keywords
socket
function
server
client
parameter
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
CN202110310964.6A
Other languages
Chinese (zh)
Other versions
CN112702362A (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.)
Beijing Acoinfo Technology Co ltd
Original Assignee
Beijing Acoinfo 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 Beijing Acoinfo Technology Co ltd filed Critical Beijing Acoinfo Technology Co ltd
Priority to CN202110310964.6A priority Critical patent/CN112702362B/en
Publication of CN112702362A publication Critical patent/CN112702362A/en
Application granted granted Critical
Publication of CN112702362B publication Critical patent/CN112702362B/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

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer And Data Communications (AREA)

Abstract

The embodiment of the invention discloses a method and a device for enhancing a TCP/IP protocol stack, electronic equipment and a storage medium, wherein the method comprises the following steps: the system comprises a client-side processing flow and a server-side processing flow, wherein the client-side processing flow is matched with the server-side processing flow; and a socket programming interface setsockopt of the server-side extension protocol stack provides a new TCP configuration option. According to the method and the device, a new TCP configuration option is provided by expanding a socket programming interface setsockopt of a protocol stack, an option value is configured for a given socket by using the new configuration option and the setsockopt programming interface, and for the given socket, except for a bound port number, the socket is continuously associated with continuous sockets after the port number to configure option value port numbers, so that the system overhead of running the same processing program on the socket configuration option value ports can be effectively reduced.

Description

Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium
Technical Field
The invention relates to the technical field of computer networks, in particular to a method and a device for enhancing a TCP/IP protocol stack, electronic equipment and a storage medium.
Background
In a classic TCP/IP network protocol stack implementation, for a given port number, only a network connection with a destination address as the designated port is accepted, and a socket is created for the network connection for upper layer application programming.
The prior art architecture design based on network layering only uses the socket created by the operating system protocol stack to program for the upper application program of the protocol stack. Therefore, when an upper layer application needs to execute the same handler on a plurality of network ports, it is necessary to create a socket through a protocol stack for each port to be used, and prepare a network connection context and initialize an application handler instance. Assuming that the system overhead required by each application processing instance is R, without special optimization, when the same handler needs to be run on N ports, the system overhead is R × N, which is large.
Accordingly, there is a need in the art for improvements.
Disclosure of Invention
The embodiment of the invention aims to solve the technical problem that: a method, an apparatus, an electronic device and a storage medium for enhancing a TCP/IP protocol stack are provided to solve the problems in the prior art.
In an embodiment of the present application, the method for enhancing a TCP/IP protocol stack includes:
the system comprises a client-side processing flow and a server-side processing flow, wherein the client-side processing flow is matched with the server-side processing flow;
the client processing flow comprises the following steps:
the client calls a socket function to create a socket;
the client uses the connect function to connect to the server;
the client calls the send function and the recv function to communicate with the server;
the client calls a close function to terminate the connection;
the server-side processing flow comprises the following steps:
the server side uses a socket function to create a socket matched with the client side, and calls a bind function to bind the socket to a monitoring port;
the server side calls a listen function to enable the socket bound to the monitoring port to become a socket in a monitoring state;
a socket programming interface setsockopt of a server-side extended protocol stack provides a new TCP configuration option;
the server receives a connection request of the client through an accept function;
the server side communicates with the client side by calling the send function and the recv function;
the server side calls the close function to close the unneeded sockets.
In another embodiment, the socket programming interface setsockopt of the server-side extension protocol stack provides new TCP configuration options, including:
expanding a setsockopt parameter of a socket programming interface of a protocol stack and adding a new configuration item optname;
assigning a value of optval of a new configuration item optname, and assigning a port extension optval associated with a socket created by the socket function to a number;
the new optname enables the protocol stack monitoring to be extended to the specified continuous port number, and the number of the specified continuous port number is assigned to the optval.
In another embodiment, when the value optval of the new configuration item optname is assigned, the assignment range of the value optval is 1 to 65535.
In another embodiment, the connect function is used to establish a network connection service between the client and the server.
In another embodiment, the send function is used for sending a request to the server by the client and sending a response to the client by the server;
the recv function is used for the client to receive the response of the server, and the server receives the request of the client.
In another embodiment, the setsockopt parameter includes a first parameter socket, a second parameter level, and a third parameter option _ name;
the first parameter socket is a socket descriptor of the setsockopt parameter;
the second parameter level is a set option level of the setsockopt parameter;
the third parameter option _ name is an option for the setsockopt parameter to be set;
when an option is set on the SOCKET level of the first parameter SOCKET, the level of the second parameter is set to be SOL _ SOCKET;
and the parameter setting of the second parameter level determines the value of the third parameter option _ name.
In another embodiment, the value of the third parameter option _ name includes:
the SO _ DEBUG indicates to open or close the debugging information when the value of the third parameter option _ name is SO _ DEBUG, wherein the SO _ DEBUG indicates to open the debugging information when the value of the SO _ DEBUG is not equal to 0, and otherwise, the debugging information is closed;
the SO _ REUSEEADDR represents that the address multiplexing function is opened or closed when the value of the third parameter option _ name is SO _ REUSEEADDR, wherein the value of the SO _ REUSEEADDR is not equal to 0, the address multiplexing function is opened, and otherwise, the address multiplexing function is closed;
the SO _ DONTROUTE represents that the route searching function is opened or closed when the value of the third parameter option _ name is SO _ DONTROUTE, wherein the route searching function is opened when the value of the SO _ DONTROUTE is not equal to 0, and the route searching function is closed when the value of the SO _ DONTROUTE is not equal to 0;
the SO _ BROADCAST indicates that the BROADCAST data is allowed to be sent or is forbidden to be sent when the value of the third parameter option _ name is SO _ BROADCAST, wherein the SO _ BROADCAST indicates that the BROADCAST data is allowed to be sent when the value of the SO _ BROADCAST is not equal to 0, and otherwise, indicates that the BROADCAST data is forbidden to be sent;
and when the value of the third parameter option _ name is SO _ SNDBUF, the SO _ SNDBUF indicates that the size of a transmission buffer is set, wherein the upper limit of the transmission buffer is 256 bytes, and the lower limit of the transmission buffer is 2048 bytes.
Based on another aspect of the embodiments of the present invention, an enhancement device of a TCP/IP protocol stack is disclosed, the device comprising:
the client is used for executing a client processing flow, calling a socket function to create a socket, connecting the socket function to the server by using a connect function, calling a send function and a recv function to communicate with the server, and calling a close function to terminate connection;
the server is used for executing the processing flow of the server, creating a socket matched with the client by using a socket function, calling a bind function to bind the socket to a monitoring port, calling a listen function to enable the socket bound to the monitoring port to become a socket in a monitoring state, expanding a socket programming interface setsockopt of a protocol stack, providing a new TCP configuration option, receiving a connection request of the client through an accept function, communicating with the client through calling a send function and a recv function, and calling a close function to close an unnecessary socket;
the client processing flow is adaptive to the server processing flow.
In accordance with yet another aspect of an embodiment of the present invention, an electronic device is disclosed, the electronic device comprising one or more processors and memory, the memory for storing one or more programs; when executed by the processor, the one or more programs cause the processor to implement the methods for enhancing the TCP/IP protocol stack provided by the embodiments of the present invention.
Based on still another aspect of the embodiments of the present invention, a computer readable storage medium storing a computer program is disclosed, which when executed, implements the method for enhancing the TCP/IP protocol stack provided by the embodiments of the present invention.
Compared with the prior art, the invention has the following advantages:
according to the method, the device, the electronic equipment and the storage medium for enhancing the TCP/IP protocol stack, a new TCP configuration option is provided by extending a socket programming interface setsockopt of the protocol stack, an option value is configured for a given socket by using the new configuration option and the setsockopt programming interface, and for the given socket, except for a bound port number, the socket is continuously associated with a continuous socket after the port number to configure an option value, namely a port number, so that the system overhead of running the same processing program on the socket configuration option value can be effectively reduced.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description, serve to explain the principles of the invention.
The invention will be more clearly understood from the following detailed description, taken with reference to the accompanying drawings, in which:
FIG. 1 is a diagram illustrating an exemplary implementation of a TCP/IP stack enhancement method;
FIG. 2 is a block diagram of an enhancement device for a TCP/IP protocol stack according to an embodiment of the present invention;
FIG. 3 is a diagram illustrating an internal structure of an electronic device in one embodiment.
Detailed Description
Various exemplary embodiments of the present invention will now be described in detail with reference to the accompanying drawings. It should be noted that: the relative arrangement of the components and steps, the numerical expressions and numerical values set forth in these embodiments do not limit the scope of the present invention unless specifically stated otherwise.
Meanwhile, it should be understood that the sizes of the respective portions shown in the drawings are not drawn in an actual proportional relationship for the convenience of description.
The following description of at least one exemplary embodiment is merely illustrative in nature and is in no way intended to limit the invention, its application, or uses.
Techniques, methods, and apparatus known to those of ordinary skill in the relevant art may not be discussed in detail but are intended to be part of the specification where appropriate.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, further discussion thereof is not required in subsequent figures.
The method for enhancing the TCP/IP protocol stack can be applied to the application environment shown in FIG. 1. The method for enhancing the TCP/IP protocol stack is applied to an enhancement device of the TCP/IP protocol stack. The client of the enhancement device of the TCP/IP protocol stack is configured at the terminal 102, the server is configured at the server 104, and the terminal 102 and the server 104 interact to complete the enhancement method of the TCP/IP protocol stack.
Wherein the terminal 102 and the server 104 can communicate through a network.
The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices, the terminal 102 needs to have a function of acquiring configuration information of the FPGA and the multi-path network port and connection information of the gigabit network card controller of the CPU and the FPGA, and summarizing the MAC addresses of the multi-path network port to information on the gigabit network card controller of the CPU, and the server 104 may be implemented by an independent server or a server cluster composed of a plurality of servers.
In an embodiment, a method for enhancing a TCP/IP protocol stack is provided, and this embodiment is mainly applied to the terminal 102 and the server 104 in fig. 1.
The method for enhancing the TCP/IP protocol stack comprises a client-side processing flow and a server-side processing flow, wherein the client-side processing flow is matched with the server-side processing flow;
the client processing flow comprises the following steps:
the client calls a socket function to create a socket;
specifically, the socket function is a function for creating a socket, and the program for the client to call the socket function to create the TCP socket is described as follows:
SOCKET socket(int af, int type, int protocol);
the return values are the same except for the different types. Windows does not treat SOCKETs as normal files but returns a SOCKET type handle. For example, one specific embodiment is:
SOCKET SOCKET = SOCKET (AF _ INET, SOCK _ STREAM, 0);/creating a TCP SOCKET.
The client uses the connect function to connect to the server;
specifically, the client establishes a connection with the TCP server using a connect function, and the procedure is described as follows:
#include<sys/socket.h>
int connect(int sockfd, const struct sockaddr *servaddr, int *addrlen);
and returning: if successful, 0 is returned, and if failed, 1 is returned.
The client calls the send function and the recv function to communicate with the server;
specifically, the program description of the client calling the send function to communicate with the server is as follows:
int send( SOCKET s, const char FAR *buf, int len, int flags );
the client sends data to the other end of the TCP connection using send function, and the client sends a request to the server using send function.
Specifically, the program description of the client calling the recv function to communicate with the server is as follows:
Int recv(SOCKETs,char FAR*buf,int len, int flags);
the client receives data from the other end of the TCP connection using a recv function whose first parameter specifies the receiver socket descriptor.
The client calls the close function to terminate the connection.
The server-side processing flow comprises the following steps:
the server side uses a socket function to create a socket matched with the client side, and calls a bind function to bind the socket to a monitoring port;
specifically, the way that the server side uses the socket function to create the socket matched with the client side is consistent with the way that the client side creates the socket, and the program that the server side calls the socket function to create the TCP socket is described as follows: SOCKET (int af, int type, int protocol).
The server side binds the socket to one monitoring port by calling the bind function, namely, the socket name created by the socket call is called by the socket, so that the socket created by the socket function can be used by other processes. For AF _ UNIX, the socket is associated with a file system pathname after calling the function, and for AF _ INET, an IP port number. The function prototype is:
int bind( int socket, const struct sockaddr *address, size_t address_len)。
the server side calls a listen function to enable the socket bound to the monitoring port to become a socket in a monitoring state;
a socket programming interface setsockopt of a server-side extended protocol stack provides a new TCP configuration option;
the server receives a connection request of the client through an accept function;
the server side communicates with the client side by calling the send function and the recv function;
specifically, the mode of the server calling the send function to communicate with the server is the same as the mode of the client calling the send function to communicate with the server, and the program description is as follows:
int send( SOCKET s, const char FAR *buf, int len, int flags );
the server side sends data to the other end of the TCP connection by using the send function, and the server side sends a response to the server by using the send function.
Specifically, the program for the server side to call the recv function to communicate with the client side is described as follows:
Int recv(SOCKETs,char FAR*buf,int len, int flags);
the server receives data from the other end of the TCP connection using a recv function whose first parameter specifies the receiver socket descriptor.
The server side calls the close function to close the unneeded sockets.
In another embodiment, the socket programming interface setsockopt of the server-side extension protocol stack provides new TCP configuration options, including:
expanding a setsockopt parameter of a socket programming interface of a protocol stack and adding a new configuration item optname;
assigning a value of optval of a new configuration item optname, and assigning a port extension optval associated with a socket created by the socket function to a number;
the new optname enables the protocol stack monitoring to be extended to the specified continuous port number, and the number of the specified continuous port number is assigned to the optval.
In a specific embodiment, for example, the corresponding value optval is set to N for the new configuration item optname. Then for that given socket, in addition to the already bound port number P, the socket will continue to associate consecutive N port numbers after that port number, i.e. the socket will receive all TCP connections requesting port number P to port number P + N. The new configuration entry optname causes the protocol stack to listen to the specified continuous port number, i.e. port number P to port number P + N.
In another embodiment, when the value optval of the new configuration item optname is assigned, the assignment range of the value optval is 1 to 65535.
In another embodiment, the connect function is used to establish a network connection service between the client and the server.
In another embodiment, the send function is used for sending a request to the server by the client and sending a response to the client by the server;
the recv function is used for the client to receive the response of the server, and the server receives the request of the client.
In another embodiment, the setsockopt parameter includes a first parameter socket, a second parameter level, and a third parameter option _ name;
the first parameter socket is a socket descriptor of the setsockopt parameter;
the second parameter level is a set option level of the setsockopt parameter;
the third parameter option _ name is an option for the setsockopt parameter to be set;
when an option is set on the SOCKET level of the first parameter SOCKET, the level of the second parameter is set to be SOL _ SOCKET;
and the parameter setting of the second parameter level determines the value of the third parameter option _ name.
In another embodiment, the value of the third parameter option _ name includes:
the SO _ DEBUG indicates to open or close the debugging information when the value of the third parameter option _ name is SO _ DEBUG, wherein the SO _ DEBUG indicates to open the debugging information when the value of the SO _ DEBUG is not equal to 0, and otherwise, the debugging information is closed;
the SO _ REUSEEADDR represents that the address multiplexing function is opened or closed when the value of the third parameter option _ name is SO _ REUSEEADDR, wherein the value of the SO _ REUSEEADDR is not equal to 0, the address multiplexing function is opened, and otherwise, the address multiplexing function is closed;
the SO _ DONTROUTE represents that the route searching function is opened or closed when the value of the third parameter option _ name is SO _ DONTROUTE, wherein the route searching function is opened when the value of the SO _ DONTROUTE is not equal to 0, and the route searching function is closed when the value of the SO _ DONTROUTE is not equal to 0;
the SO _ BROADCAST indicates that the BROADCAST data is allowed to be sent or is forbidden to be sent when the value of the third parameter option _ name is SO _ BROADCAST, wherein the SO _ BROADCAST indicates that the BROADCAST data is allowed to be sent when the value of the SO _ BROADCAST is not equal to 0, and otherwise, indicates that the BROADCAST data is forbidden to be sent;
and when the value of the third parameter option _ name is SO _ SNDBUF, the SO _ SNDBUF indicates that the size of a transmission buffer is set, wherein the upper limit of the transmission buffer is 256 bytes, and the lower limit of the transmission buffer is 2048 bytes.
According to the method for enhancing the TCP/IP protocol stack, a new TCP configuration option is provided by extending a socket programming interface setsockopt of the protocol stack, an option value is configured for a given socket by using the new configuration option and the setsockopt programming interface, and for the given socket, except for a bound port number, the socket is continuously associated with the port number of a continuous socket configuration option value after the port number, so that the system overhead of running the same processing program on the socket configuration option value ports can be effectively reduced.
In one embodiment, as shown in fig. 2, there is provided an enhancement apparatus of a TCP/IP protocol stack, including: server side, customer end.
The acquisition module is used for acquiring a big data file to be displayed;
the client is used for executing a client processing flow, calling a socket function to create a socket, connecting the socket function to the server by using a connect function, calling a send function and a recv function to communicate with the server, and calling a close function to terminate connection;
the server is used for executing the processing flow of the server, creating a socket matched with the client by using a socket function, calling a bind function to bind the socket to a monitoring port, calling a listen function to enable the socket bound to the monitoring port to become a socket in a monitoring state, expanding a socket programming interface setsockopt of a protocol stack, providing a new TCP configuration option, receiving a connection request of the client through an accept function, communicating with the client through calling a send function and a recv function, and calling a close function to close an unnecessary socket;
the client processing flow is adaptive to the server processing flow.
The enhancement device of the TCP/IP protocol stack provides a new TCP configuration option by extending a socket programming interface setsockopt of the protocol stack, and configures an option value for a given socket by using the new configuration option and the setsockopt programming interface, so that for the given socket, except for the bound port numbers, the socket will continue to associate with the port numbers of the option values of the successive sockets after the port number, and the system overhead of running the same processing program on the ports of the option value of the socket configuration can be effectively reduced.
The specific definition of the enhancement device of the TCP/IP protocol stack can refer to the definition of the enhancement method of the TCP/IP protocol stack, which is not described herein again. The various modules in the enhancement apparatus of the TCP/IP protocol stack described above may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
In one embodiment, an electronic device is provided, which may be a terminal, and its internal structure diagram may be as shown in fig. 3. The electronic device comprises a processor, a memory, a communication interface, a display screen and an input device which are connected through a system bus. Wherein the processor of the electronic device is configured to provide computing and control capabilities. The memory of the electronic equipment comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the electronic device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, Near Field Communication (NFC) or other technologies. The computer program is executed by a processor to implement an enhanced method of a TCP/IP protocol stack. The display screen of the electronic equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the electronic equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the electronic equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 3 is a block diagram of only a portion of the architecture associated with the subject application, and does not constitute a limitation on the electronic devices to which the subject application may be applied, and that a particular electronic device may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the enhancement apparatus of the TCP/IP protocol stack provided in the present application may be implemented in the form of a computer program, and the computer program may be run on an electronic device as shown in fig. 3. The memory of the electronic device may store various program modules constituting the TCP/IP stack-based enhancement apparatus, such as the server side and the client side shown in fig. 2. The computer program constituted by the program modules makes the processor execute the steps in the enhancement method of the TCP/IP protocol stack of the embodiments of the present application described in the present specification.
For example, the electronic device shown in fig. 3 may execute a client processing flow through a client of the enhancement apparatus of the TCP/IP protocol stack shown in fig. 2, call a socket function to create a socket, connect to the server using a connect function, call a send function and a recv function to communicate with the server, and call a close function to terminate the connection; the server executes the processing flow of the server, a socket function is used for creating a socket matched with the client, a bind function is called to bind the socket to a monitoring port, a list function is called to enable the socket bound to the monitoring port to become a socket in a monitoring state, a socket programming interface setsockopt of a protocol stack is extended to provide a new TCP configuration option, a connection request of the client is received through an accept function, the client communicates with the client through calling a send function and a recv function, and a close function is called to close unneeded sockets; the client processing flow is adaptive to the server processing flow.
When the computer program is executed by the processor, a new TCP configuration option is provided through a socket programming interface setsockopt of an extended protocol stack, and an option value is configured for a given socket by using the new configuration option and the setsockopt programming interface, so that for the given socket, except for the already bound port numbers, the socket will continue to associate with the port numbers of the option values of the successive sockets after the port number is configured, and the system overhead of running the same processing program on the ports of the socket configuration option values can be effectively reduced.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, database, or other medium used in the embodiments provided herein may include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM is available in many forms, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), and the like.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (9)

1. A method for enhancing a TCP/IP protocol stack, comprising:
the system comprises a client-side processing flow and a server-side processing flow, wherein the client-side processing flow is matched with the server-side processing flow;
the client processing flow comprises the following steps:
the client calls a socket function to create a socket;
the client uses the connect function to connect to the server;
the client calls the send function and the recv function to communicate with the server;
the client calls a close function to terminate the connection;
the server-side processing flow comprises the following steps:
the server side uses a socket function to create a socket matched with the client side, and calls a bind function to bind the socket to a monitoring port;
the server side calls a listen function to enable the socket bound to the monitoring port to become a socket in a monitoring state;
a socket programming interface setsockopt of a server-side extended protocol stack provides a new TCP configuration option;
the server receives a connection request of the client through an accept function;
the server side communicates with the client side by calling the send function and the recv function;
calling a close function by the server side to close the unneeded sockets;
the socket programming interface setsockopt of the server-side extended protocol stack provides new TCP configuration options, including:
expanding a setsockopt parameter of a socket programming interface of a protocol stack and adding a new configuration item optname;
assigning a value of optval of a new configuration item optname, and assigning a port extension optval associated with a socket created by the socket function to a number;
the new optname enables the protocol stack monitoring to be extended to the specified continuous port number, and the number of the specified continuous port number is assigned to the optval.
2. The method according to claim 1, wherein when assigning the value optval of the new configuration item optname, the range of assignment of the optval is 1 to 65535.
3. The method of claim 1, wherein the connect function is used to establish a network connection service between the client and the server.
4. The method for enhancing the TCP/IP protocol stack of claim 1, wherein the send function is used to send a request from the client to the server, and send a response from the server to the client;
the recv function is used for the client to receive the response of the server, and the server receives the request of the client.
5. The method of claim 1, wherein the setsockopt parameter comprises a first parameter socket, a second parameter level, and a third parameter option _ name;
the first parameter socket is a socket descriptor of the setsockopt parameter;
the second parameter level is a set option level of the setsockopt parameter;
the third parameter option _ name is an option for the setsockopt parameter to be set;
when an option is set on the SOCKET level of the first parameter SOCKET, the level of the second parameter is set to be SOL _ SOCKET;
and the parameter setting of the second parameter level determines the value of the third parameter option _ name.
6. The method of claim 5, wherein the value of the third parameter option _ name comprises:
the SO _ DEBUG indicates to open or close the debugging information when the value of the third parameter option _ name is SO _ DEBUG, wherein the SO _ DEBUG indicates to open the debugging information when the value of the SO _ DEBUG is not equal to 0, and otherwise, the debugging information is closed;
the SO _ REUSEEADDR represents that the address multiplexing function is opened or closed when the value of the third parameter option _ name is SO _ REUSEEADDR, wherein the value of the SO _ REUSEEADDR is not equal to 0, the address multiplexing function is opened, and otherwise, the address multiplexing function is closed;
the SO _ DONTROUTE represents that the route searching function is opened or closed when the value of the third parameter option _ name is SO _ DONTROUTE, wherein the route searching function is opened when the value of the SO _ DONTROUTE is not equal to 0, and the route searching function is closed when the value of the SO _ DONTROUTE is not equal to 0;
the SO _ BROADCAST indicates that the BROADCAST data is allowed to be sent or is forbidden to be sent when the value of the third parameter option _ name is SO _ BROADCAST, wherein the SO _ BROADCAST indicates that the BROADCAST data is allowed to be sent when the value of the SO _ BROADCAST is not equal to 0, and otherwise, indicates that the BROADCAST data is forbidden to be sent;
and when the value of the third parameter option _ name is SO _ SNDBUF, the SO _ SNDBUF indicates that the size of a transmission buffer is set, wherein the upper limit of the transmission buffer is 256 bytes, and the lower limit of the transmission buffer is 2048 bytes.
7. An apparatus for enhancing a TCP/IP protocol stack, the apparatus comprising:
the client is used for executing a client processing flow, calling a socket function to create a socket, connecting the socket function to the server by using a connect function, calling a send function and a recv function to communicate with the server, and calling a close function to terminate connection;
the server is used for executing the processing flow of the server, creating a socket matched with the client by using a socket function, calling a bind function to bind the socket to a monitoring port, calling a listen function to enable the socket bound to the monitoring port to become a socket in a monitoring state, expanding a socket programming interface setsockopt of a protocol stack, providing a new TCP configuration option, receiving a connection request of the client through an accept function, communicating with the client through calling a send function and a recv function, and calling a close function to close an unnecessary socket;
the client processing flow is matched with the server processing flow;
the socket programming interface setsockopt of the server-side extended protocol stack provides new TCP configuration options, including: expanding a setsockopt parameter of a socket programming interface of a protocol stack and adding a new configuration item optname; assigning a value of optval of a new configuration item optname, and assigning a port extension optval associated with a socket created by the socket function to a number; the new optname enables the protocol stack monitoring to be extended to the specified continuous port number, and the number of the specified continuous port number is assigned to the optval.
8. An electronic device, comprising one or more processors and memory, the memory to store one or more programs;
the one or more programs, when executed by the processor, cause the processor to implement the method of any of claims 1-6.
9. A computer-readable storage medium storing a computer program, characterized in that the computer program, when executed, implements the method of any one of claims 1 to 6.
CN202110310964.6A 2021-03-24 2021-03-24 Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium Active CN112702362B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110310964.6A CN112702362B (en) 2021-03-24 2021-03-24 Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110310964.6A CN112702362B (en) 2021-03-24 2021-03-24 Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN112702362A CN112702362A (en) 2021-04-23
CN112702362B true CN112702362B (en) 2021-06-08

Family

ID=75515593

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110310964.6A Active CN112702362B (en) 2021-03-24 2021-03-24 Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112702362B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114390024B (en) * 2021-12-31 2024-03-19 中科南京移动通信与计算创新研究院 Access network protocol stack test method, system and storage medium
CN116366639B (en) * 2023-06-01 2023-11-14 深圳市七彩虹禹贡科技发展有限公司 Method and system for updating BIOS of main board in networking manner under UEFI

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP3238401B1 (en) * 2014-12-23 2019-02-20 Huawei Technologies Co., Ltd. Network extended tcp splicing
CN105991462B (en) * 2015-03-02 2019-05-28 华为技术有限公司 Sending method, sending device and the system of transmission control protocol TCP data packet
CN104734825B (en) * 2015-03-03 2018-04-06 国家电网公司 A kind of network redundancy fault-tolerance approach and system based on IP agreement extension
CN106506644A (en) * 2016-11-07 2017-03-15 深圳市共进电子股份有限公司 Terminal Debugging message collection method and system
US20210058329A1 (en) * 2018-01-26 2021-02-25 Idac Holdings, Inc. Application mobility based on enhanced mptcp

Also Published As

Publication number Publication date
CN112702362A (en) 2021-04-23

Similar Documents

Publication Publication Date Title
CN108052675B (en) Log management method, system and computer readable storage medium
US5748897A (en) Apparatus and method for operating an aggregation of server computers using a dual-role proxy server computer
US5818448A (en) Apparatus and method for identifying server computer aggregation topologies
EP2321937B1 (en) Load balancing for services
US8291486B2 (en) Gateway device having socket library for monitoring, communication method of gateway device having socket library for monitoring, and communication program of gateway device having socket library for monitoring
US20030231632A1 (en) Method and system for packet-level routing
CN112702362B (en) Method and device for enhancing TCP/IP protocol stack, electronic equipment and storage medium
CN109088799B (en) Client access method, device, terminal and storage medium
US8539089B2 (en) System and method for vertical perimeter protection
CN112769794B (en) Data conversion method and device
CN113259415B (en) Network message processing method and device and network server
CN112822061B (en) Method and system for exposing service to outside by edge node
CN114268667B (en) Data forwarding method, device, computer equipment and storage medium
US11861386B1 (en) Application gateways in an on-demand network code execution system
US20050144290A1 (en) Arbitrary java logic deployed transparently in a network
CN111787105B (en) File transmission method, device, computer equipment and storage medium
CN104423944B (en) A kind of software application system
US7363383B2 (en) Running a communication protocol state machine through a packet classifier
CN116881040A (en) Service operation processing method and device, electronic device and storage medium
CN112165449A (en) Control method of real-time authority of web application, electronic device and storage medium
US20050188070A1 (en) Vertical perimeter framework for providing application services
CN104969533B (en) A kind of data package processing method and device
US8499023B1 (en) Servlet-based grid computing environment using grid engines and switches to manage resources
US7290055B2 (en) Multi-threaded accept mechanism in a vertical perimeter communication environment
WO2020031726A1 (en) Server, server system, and method for increasing server network bandwidth

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