About HTTPKeep-Alive

Source: Internet
Author: User
I only know that he can maintain a persistent connection. I have a small question: How does he identify whether he is the same user? Is it an IP address? If so, can I use this persistent link for all the local networks? I only know that he can maintain a persistent connection. I have a small question: How does he identify whether he is the same user? Is it an IP address? If so, can I use this persistent link for all the local networks?

Reply content:

I only know that he can maintain a persistent connection. I have a small question: How does he identify whether he is the same user? Is it an IP address? If so, can I use this persistent link for all the local networks?

The tcp protocol contains four elements: Source Address, source port number, destination address, and destination port number. Both parties start to establish communication. These four elements are fixed. Assume that the http server listens to port 80, for the client browser, these four elements are:Browser ip Address The socket handle port number that the browser operating system assigns to the current request Web server address 80. Before creating a socket, the browser needs to apply for a socket handle from the operating system, obtain a local socket handle port number, and then establish a TCP connection with the server through three handshakes. After the connection is established, a socket handle is also available on the server. At the same time, at the TCP layer, each TCP request also has a seq number generated during the TCP handshake. When both parties perform communication, the seq number is parsed from the packets in the NIC, and the corresponding socket handle is known.

First, the two sides of the connection have been established when the connection is established, and only users at both ends of the established connection can use this persistent connection.
When you open a browser on your computer to connect to your website, it is the connection between your computer and the website server, other computers cannot borrow your connection.

The connection is formed by the ing between the terminal (your computer or website server) through the socket port socket to determine and identify the connection, which is also achieved through the port of the corresponding host.

Session.

Long links and short links refer to the TCP layer. The user identification at the HTTP layer is still through SESSION.

1. The HTTP Keep-Alive refers to the persistent connection of the TCP/IP Socket, that is, the user's browser => Web container to deal with this problem, and it has nothing to do with your code.

2. to maintain persistent connections, the same Client initiates a request to the Web Container of the server again in a short period of time and does not need to perform another handshake to establish a connection, this reduces server processing time and increases the processing speed of the next request.

3. For a Socket,CreatedOfOneTCP connection is applicableOne IP AddressOfPort for initiating a request, AndRemote ServerOfOne IP AddressOfA port that accepts the request. Because HTTP persistent connections are based on thisSame userLong connection, butSame Connection.

4. the reason why a vro allows all Intranet users to use the same Internet IP address to initiate network requests is due to the NAT mechanism. Therefore, when an intranet user initiates a request to a Web container, it is the outermost network node (such as a router) of the Intranet ). When the Web Container returns data, the router can use NAT overload to distinguish the destination of the data packet and send it to the port of the specified Intranet device, so there will be no connection between all the devices in the intranet.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.