HTTP in Computer Networks

HTTP is a transfer protocol used to access data on WWW. In each interaction, the client sends an ASCII request to the server and in response, the server sends MIME like data to the client. It is defined in RFC 2626. HTTP uses well-known port number 80 for establishing TCP connection to the server. There are two types of connection available for HTTP:

1. Non-persistent connection: HTTP version 1.0 used the non-persistent connection in which after the connection was established a single request was sent by the client and then a single response was sent by the server. The TCP connection was then released. With the development of the internet, web pages became crowded with pictures, images and icons etc. So, establishing a TCP connection to transfer an icon became a costly affair. To recover this, a persistent connection is used today.

2. Persistent connection: HTTP version 1.1 uses persistent connection. In this system, after establishing a TCP connection the client sends a request and then the server sends the response. After that, the server leaves the connection open for accepting more requests. In case the server does not get any more requests from the client it closes the connection after the timeout. The sender usually sends the length of data sent. But in case it is not known then it informs the client that the length of the data is unknown and closes the connection after sending the data.