CN112019374A - Network communication optimization method and system - Google Patents
Network communication optimization method and system Download PDFInfo
- Publication number
- CN112019374A CN112019374A CN202010678874.8A CN202010678874A CN112019374A CN 112019374 A CN112019374 A CN 112019374A CN 202010678874 A CN202010678874 A CN 202010678874A CN 112019374 A CN112019374 A CN 112019374A
- Authority
- CN
- China
- Prior art keywords
- client
- connection
- server
- identification
- connection request
- 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
Links
Images
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0803—Configuration setting
- H04L41/0823—Configuration setting characterised by the purposes of a change of settings, e.g. optimising configuration for enhancing reliability
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/14—Session management
- H04L67/141—Setup of application sessions
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/60—Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Computer And Data Communications (AREA)
Abstract
The invention relates to a network communication optimization method and a system, wherein the system comprises the following steps: in a handshake process of establishing a first connection between a client and a server, the server generates a client identifier and stores the client identifier; and in the subsequent second connection establishment process of the client and the server, establishing connection through the client identifier. The server network communication optimization system comprises a client identification generation module and a client identification verification module, and the client network communication optimization system comprises a client connection module, a client identification storage module and an information adding module. The invention optimizes the network connection process, in the handshake process of establishing connection for the first time, the server generates the client identifier for the client and stores the client identifier, in the subsequent connection process, the connection can be established through the client identifier, and the three-way handshake process is omitted, so the connection establishment is rapid, and the consumption of resources can be saved.
Description
Technical Field
The present invention relates to the field of network communication technologies, and in particular, to a method and a system for optimizing network communication.
Background
TCP is a connection-oriented unicast protocol, and two communicating parties must establish a connection between each other before sending data. The "connection" is a communication channel identified by IP addresses and ports at both ends, and the establishment of a TCP connection is a process of registering the communication channel with both parties of communication. The client and the server establish a connection through three handshakes. The three-way handshake causes huge consumption of network resources and CPU resources, and the client and the server maintain their respective sending and receiving caches and their respective variables in the operating system, such as file descriptors and data structures maintained by the operating system. Therefore, in the current TCP connection, the TCP connection between the client and the server needs to be reestablished through three handshakes with huge resource consumption, which results in low connection efficiency and large resource consumption.
Disclosure of Invention
Aiming at the technical problems in the prior art, the invention provides a network communication optimization method and a network communication optimization system, which are used for improving the efficiency of reestablishing network connection.
In order to solve the above technical problem, according to an aspect of the present invention, there is provided a network communication optimization method, including: in the handshake process of the first connection between the client and the server, the server generates a client identifier and stores the client identifier; and in the subsequent second connection establishment process of the client and the server, establishing connection through the client identifier.
In order to solve the above technical problem, according to another aspect of the present invention, there is provided a server network communication optimization system, including: the system comprises a server connection module, a client identification generation module and a client identification verification module, wherein the server connection module is configured to respond to a first connection request of a client, establish connection with the first connection request through handshaking, respond to a second connection request of the client, and establish connection with the second connection request through a client identification; the client identification generation module is configured to generate a client identification in response to a client first connection request; the client identification verification module is configured to respond to a second connection request sent by the client and verify the client identification in the second connection request.
In order to solve the above technical problem, according to another aspect of the present invention, there is provided a client network communication optimization system, including: the client connection module is configured to send a first connection request to the server and establish a first connection with the server through handshaking; during subsequent connection, sending a second connection request to the server, and establishing connection with the server through the client identifier; the client identification storage module is configured to store a client identification in a response message of the server to the first connection request; the information adding module is configured to add an identification request in the first connection request and a client identification in the second connection request.
The invention optimizes the network connection process, in the handshake process of establishing connection for the first time, the server generates the client identifier for the client and stores the client identifier, in the subsequent connection process, the connection can be established through the client identifier, and the three-way handshake process is omitted, so the connection establishment is rapid, and the consumption of resources can be saved.
Drawings
Preferred embodiments of the present invention will now be described in further detail with reference to the accompanying drawings, in which:
FIG. 1 is a flow diagram of a method for network communication optimization according to one embodiment of the invention; and
fig. 2 is a schematic block diagram of a network communication optimization system according to an 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 technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
In the following detailed description, reference is made to the accompanying drawings that form a part hereof and in which is shown by way of illustration specific embodiments of the application. In the drawings, like numerals describe substantially similar components throughout the different views. Various specific embodiments of the present application are described in sufficient detail below to enable those skilled in the art to practice the teachings of the present application. It is to be understood that other embodiments may be utilized and structural, logical or electrical changes may be made to the embodiments of the present application.
Fig. 1 is a flowchart illustrating a method for optimizing network communication according to an embodiment of the present invention. In the handshake process of establishing the first connection between the client and the server, the method comprises the following steps:
step S10, the client sends a first connection request to the server, where the request includes a client Syn code and a client id request. The first connection request refers to a request sent when connection is established between the client and the server for the first time.
In step S11, when the server receives the first connection request and the first connection request includes the client identifier request, the server generates a client identifier for the client. The client identifier may be randomly generated, or may be generated according to an initial serial number ISN in a client Syn code sent by the client. For example, it is hashed, so that the hash value is used as the client identification. In one embodiment, the server sets a cookie, and the cookie is used as a client identifier, wherein the cookie name and a corresponding value are included.
And step S12, the server puts the generated client identifier in a response message, and sends the response message, the Syn code of the server and the ACK code to the client.
In step S13, after receiving the response message from the server, the client extracts the client id from the response message and stores the client id, and in step S14, sends an ACK code to the server.
And after the server receives the ACK confirmation code and successfully verifies, the server and the client transmit data to realize network communication.
In the handshake process of the first connection, the server generates a client identifier, and the client stores the client identifier generated by the server.
When the connection between the client and the server is disconnected and the connection request is initiated again at the client, the connection can be quickly established with the server through the client identifier. In order to distinguish the connection request sent by the client when the connection is established for the first time from the connection request sent again later, the connection request which is obtained by the client when the connection is established for the first time is called a first connection request, and the connection request which is sent later and includes the client identifier is called a second connection request.
Step S20, the client sends a second connection request to the server, where the request includes a client Syn code, a client id, and a data request. At this time, the client no longer waits for the three-way handshake before sending the data request, but sends the data request when sending the second connection request.
Step S21, when the server receives the second connection request, the server verifies the client identifier therein, and determines whether the received client identifier is legal. For example, the cookie name and value in the cookie in the second connection request are compared with the cookie name and value in the cookie stored by the server and generated at the time of the first connection request, respectively. If the cookie name and value are both the same, the authentication is passed, and response data in response to its request is returned to the client at step S22. If the verification is not passed, at step S23, a handshake procedure is performed with the client to establish a connection, i.e., to send the server Syn code and the ACK code to the client. Then, in step S24, the client sends the ACK code after receiving the Syn code and the ACK code of the server. After the handshake, the connection is reestablished, the client sends a data request to the server, and the server responds to the data request and sends response data.
As can be seen from the above process, if the server side successfully verifies the client side identifier, a connection between the server side identifier and the client side identifier is established, and the server side can directly respond to the data request and return response data to the client side; if the verification is unsuccessful, the handshake is again performed to establish the connection. Therefore, after the TCP connection between the client and the server is closed, the connection can be quickly established through the client identifier, and the handshaking process is omitted, so that the resource consumption is saved.
Fig. 2 is a schematic block diagram of a network communication optimization system according to an embodiment of the present invention, wherein the server system includes: the system comprises a server connection module 201, a client identification generation module 202 and a client identification verification module 203, wherein the server connection module 201 establishes connection with a handshake of a client when receiving a first connection request of the client. When a first connection request received from the client includes a client identifier request, an identifier generation request is sent to the client identifier generation module 202. The client identifier generating module 202 responds to the identifier generating request to generate a client identifier, and sends the client identifier to the server connecting module 201. The client identifier may be randomly generated, or may be generated according to the Syn code of the client. The server connection module 201 sends the response message of the second handshake with the client id to the client.
When receiving the second connection request of the client, the server connection module 201 extracts the client identifier from the second connection request, generates a verification request, and sends the verification request to the client identifier verification module 203. The client identifier verifying module 203 verifies the client identifier and sends the verification result to the server connecting module 201. After the verification is successful, the server connection module 201 does not perform the handshake process any more, but transfers the data request in the second connection request to the corresponding server data module 204, and the server data module 204 obtains the response data and sends the response data to the client. If the authentication is not successful, the server connection module 201 performs a handshake procedure with the client.
In some embodiments, the server-side system further comprises an optimization module (not shown) connected to the client identity generation module 202 and the client identity verification module 203. The optimization module stores different client identifications generated by different connections of the same client. If the number of server connections has reached a predetermined number, it is possible to choose to initiate an optimization, using the existing connections for data communication between the server and the client, and to differentiate between different client identities without having to establish a new connection.
The client system includes a client connection module 211, a client identification storage module 212, and an information adding module 213. When the client connection module 211 sends the first connection request, the information adding module 213 adds the identification request to the first connection request. When receiving the response message sent back by the server, the client connection module 211 obtains the client identifier from the response message, and stores the client identifier to the specified location by the client identifier storage module 212. When the client connection module 211 sends the second connection request, the information adding module 213 reads the client identifier from the designated location, adds the client identifier to the second connection request, and obtains the data request from the client data module 214 and adds the data request to the second connection request.
The network communication optimization system provided by the invention optimizes the network connection process, the client identification is generated for the client by the server and stored by the client in the handshake process of initial connection establishment, and the connection can be established through the client identification in the subsequent connection process, so that the three-way handshake process is omitted, the connection establishment is fast, and the consumption of resources can be saved.
The above embodiments are provided only for illustrating the present invention and not for limiting the present invention, and those skilled in the art can make various changes and modifications without departing from the scope of the present invention, and therefore, all equivalent technical solutions should fall within the scope of the present invention.
Claims (13)
1. A method for optimizing network communications, comprising:
in a handshake process of establishing a first connection between a client and a server, the server generates a client identifier and stores the client identifier; and
and in the subsequent second connection establishment process of the client and the server, establishing connection through the client identifier.
2. The method of claim 1, wherein establishing a connection via the client identity comprises:
the client comprises a data request and a client identifier in the second connection request;
the server side verifies the client side identification when receiving the client side connection request; and
and responding to the verification passing of the client identification, and returning response data corresponding to the data request to the client.
3. The method of claim 2, wherein the server establishes the second connection with the client via a handshake in response to the verification of the client identification failing.
4. The method of claim 1, comprising:
when a client sends a first connection request, the first connection request comprises an identification request;
when receiving a first connection request of a client, a server responds to the identification request to generate a client identification for the client;
when the server side sends a response message of the second handshake, the response message comprises the client side identification; and
and when the client receives the second handshake response message of the server, the client obtains the client identifier from the second handshake response message and stores the client identifier.
5. The method of claim 1, further comprising: and the server sets a cookie according to the first connection request, and the cookie is used as a client identifier.
6. The method of claim 5, wherein the cookie includes a cookie name and a corresponding value.
7. The method of claim 6, further comprising: randomly generating the cookie name and a corresponding value thereof; or generating the cookie name and the corresponding value thereof according to the Syn code sent by the client.
8. A server-side network communication optimization system, comprising:
the server side connection module is configured to respond to a first connection request of the client side, establish connection with the client side connection request through handshaking, respond to a second connection request of the client side, and establish connection with the client side connection request through a client side identification;
a client identifier generation module configured to generate a client identifier in response to a client first connection request; and
and the client identification verification module is configured to respond to the second connection request sent by the client and verify the client identification in the second connection request.
9. The optimization system of claim 8, wherein the client identification generation module sets a cookie as the client identification in response to the first connection request.
10. The optimization system of claim 9, wherein the client identifier generation module randomly generates a cookie name and a value corresponding thereto; or generating a cookie name and a value corresponding to the cookie name according to the Syn code sent by the client.
11. The optimization system of claim 8, wherein the server connection module establishes a connection with the client via a handshake in response to the client identification validation module failing to validate the client identification in the second connection request.
12. A client network communication optimization system, comprising:
the client connection module is configured to send a first connection request to the server and establish a first connection with the server through handshaking; during subsequent connection, sending a second connection request to the server, and establishing connection with the server through the client identifier;
the client identification storage module is configured to store the client identification in a response message of the server to the first connection request; and
and the information adding module is configured to add the identification request in the first connection request and add the client identification in the second connection request.
13. The optimization system of claim 11, wherein the client connection module establishes a connection with the server by handshaking upon receiving a response message from the server to the second connection request.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010678874.8A CN112019374A (en) | 2020-07-15 | 2020-07-15 | Network communication optimization method and system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010678874.8A CN112019374A (en) | 2020-07-15 | 2020-07-15 | Network communication optimization method and system |
Publications (1)
Publication Number | Publication Date |
---|---|
CN112019374A true CN112019374A (en) | 2020-12-01 |
Family
ID=73498739
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010678874.8A Pending CN112019374A (en) | 2020-07-15 | 2020-07-15 | Network communication optimization method and system |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN112019374A (en) |
Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101022455A (en) * | 2006-12-26 | 2007-08-22 | 北京大学 | Web communication encrypting method |
CN105337961A (en) * | 2012-11-02 | 2016-02-17 | 北京奇虎科技有限公司 | Method for communication with client side and server |
CN106027600A (en) * | 2016-04-29 | 2016-10-12 | 北京小米移动软件有限公司 | Connection establishing method and device |
CN106161404A (en) * | 2015-04-22 | 2016-11-23 | 阿里巴巴集团控股有限公司 | The method of SSL Session state reuse, server and system |
CN109936529A (en) * | 2017-12-15 | 2019-06-25 | 华为技术有限公司 | A kind of methods, devices and systems of secure communication |
-
2020
- 2020-07-15 CN CN202010678874.8A patent/CN112019374A/en active Pending
Patent Citations (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101022455A (en) * | 2006-12-26 | 2007-08-22 | 北京大学 | Web communication encrypting method |
CN105337961A (en) * | 2012-11-02 | 2016-02-17 | 北京奇虎科技有限公司 | Method for communication with client side and server |
CN106161404A (en) * | 2015-04-22 | 2016-11-23 | 阿里巴巴集团控股有限公司 | The method of SSL Session state reuse, server and system |
CN106027600A (en) * | 2016-04-29 | 2016-10-12 | 北京小米移动软件有限公司 | Connection establishing method and device |
CN109936529A (en) * | 2017-12-15 | 2019-06-25 | 华为技术有限公司 | A kind of methods, devices and systems of secure communication |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
KR101243073B1 (en) | Method for terminal configuration and management and terminal apparatus | |
CN110365741B (en) | Connection establishing method and transfer server | |
US20230336993A1 (en) | Virtual private dial-up network access method, network-side system, system and storage medium | |
CN110958111A (en) | Electric power mobile terminal identity authentication mechanism based on block chain | |
CN111783068A (en) | Device authentication method, system, electronic device and storage medium | |
CN111327650A (en) | Data transmission method, device, equipment and storage medium | |
CN112492017A (en) | Websocket connection method and system based on token authentication | |
CN111541776A (en) | Safe communication device and system based on Internet of things equipment | |
CN110290176B (en) | Point-to-point information pushing method based on MQTT | |
CN101547158B (en) | PADT message interaction method and device in PPPoE session | |
CN103973648B (en) | Application data method for pushing, apparatus and system | |
CN117097487B (en) | Remote authentication method, system and medium for simplifying trusted execution environment by using digital certificate authentication | |
CN105812380A (en) | Verification method and device | |
CN111510302A (en) | Method and system for improving certificate verification efficiency in secure communication protocol | |
CN112019374A (en) | Network communication optimization method and system | |
CN114500237B (en) | Communication method and system | |
CN100450018C (en) | Method for raising Diameter internodal communication reliability | |
CN106162645B (en) | A kind of the quick of Mobile solution reconnects method for authenticating and system | |
CN111541732B (en) | Method for avoiding invalid occupation of connection resources by client in P2P network, computer readable storage medium and P2P network | |
CN117439745A (en) | Process communication control method, device, equipment and storage medium | |
CN111698096B (en) | Automatic safe login method for intelligent household equipment based on NDN | |
CN114697954A (en) | Method and system for realizing remote card writing by using equipment long connection | |
CN106487643B (en) | Information storage method and device for instant messaging | |
CN113810391A (en) | Cross-machine-room communication bidirectional authentication and encryption method | |
CN113573384A (en) | Terminal, terminal network distribution method and device, and storage medium |
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 | ||
WD01 | Invention patent application deemed withdrawn after publication | ||
WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20201201 |