How do I keep HTTP connection open?

Most of the remaining client Internet server protocols (HTTP, Telnet, SSH, SMTP) are superimposed over TCP. Thus, the client opens a connection (socket), writes its request (which is transmitted as one or several pockets in the base IP) to the socket, reads the response of the socket (and the response can contain data from several IP packets as well), and then Then the choice is to open the connection for the next request or close it. Pre-KeepAlive HTTP always closed the connection. New clients and servers can leave it open.



The advantage of is that establishing a connection is expensive. Short requests and responses may require more packets than actual data exchange.