Category: Computer Networks

HyperText Transfer Protocol | HTTP Tutorial

Application Layer Protocols-

 

Important application layer protocols are-

 

 

  1. Domain Name Service (DNS)
  2. Hyper Text Transfer Protocol (HTTP)
  3. Simple Mail Transfer Protocol (SMTP)
  4. Post Office Protocol (POP)
  5. File Transfer Protocol (FTP)

 

In this article, we will discuss about Hyper Text Transfer Protocol (HTTP).

 

Hyper Text Transfer Protocol-

 

  • HTTP is short for Hyper Text Transfer Protocol.
  • It is an application layer protocol.

 

Purpose-

 

  • It is mainly used for the retrieval of data from websites throughout the internet.
  • It works on the top of TCP/IP suite of protocols.

 

Working-

 

HTTP uses a client-server model where-

  • Web browser is the client.
  • Client communicates with the web server hosting the website.

 

 

Whenever a client requests some information (say clicks on a hyperlink) to the website server.

The browser sends a request message to the HTTP server for the requested objects.

 

Then-

  • HTTP opens a connection between the client and server through TCP.
  • HTTP sends a request to the server which collects the requested data.
  • HTTP sends the response with the objects back to the client.
  • HTTP closes the connection.

 

HTTP Connections-

 

HTTP connections can be of two types-

  1. Non-persistent HTTP connection
  2. Persistent HTTP connection

 

 

Non-persistent HTTP connection Persistent HTTP connection
Non-persistent HTTP connection is one that is used for serving exactly one request and sending one response. Persistent HTTP connection is one that can be used for serving multiple requests.
HTTP server closes the TCP connection automatically after sending a HTTP response. HTTP server closes the TCP connection only when it is not used for a certain configurable amount of time.
A new separate TCP connection is used for each object. A single TCP connection is used for sending multiple objects one after the other.
HTTP 1.0 supports non-persistent connections by default. HTTP 1.1 supports persistent connections by default.

Example-

 

Suppose a request has been made for a HTML page that contains 10 images (called objects).

Then,

With non-persistent connection, all the 11 objects (1 page + 10 images) will be sent one by one.

For getting each object, a new separate connection will be opened and used.

Example-

 

Suppose a request has been made for a HTML page that contains 10 images (called objects).

Then,

With persistent connection, all the 11 objects (1 page + 10 images) will be sent one after the other using a single TCP connection.

 

 

Important Notes-

 

Note-01:

 

HTTP uses TCP at the transport layer.

 

This is because-

  • Unlike UDP, it guarantees the delivery of data via a Three-way handshake.
  • It ensures the re transmission of lost packets.
  • HTTP does not have any inbuilt facility for providing reliability.
  • So, if HTTP uses UDP, then it will have to maintain or handle the session on its own.
  • For example- If a packet gets lost, then HTTP will have to re-transmit the packet.

 

Note-02:

 

It is important to know-

  • Any service which does not use TCP should have the inbuilt facility for providing reliability.

 

Note-03:

 

HTTP uses port number 80.

 

  • HTTP clients uses port 80 to send and receive requested web pages from a HTTP server.
  • Similarly, HTTP server responds to all the requests at port 80.

 

Note-04:

 

HTTP 1.0 is non-persistent and HTTP 1.1 is persistent.

 

  • Already discussed in the above table.
  • Persistent connections improve the performance by 20%.

 

Note-05:

 

HTTP 1.0 is a connectionless protocol.

 

This is because-

  • After serving the single HTTP request, the connection is closed and it is not used again.
  • So, HTTP 1.0 without connection keep alive is connectionless.

 

Note-06:

 

HTTP is an in-band protocol.

 

This is because-

  • HTTP passes the control data (commands) and main data over the same connection.
  • Both control data and main data are processed in the same way without any distinction.
  • No high priority is given to the control data (commands).

 

Note-07:

 

HTTP is a stateless protocol.

 

This is because-

  • HTTP server does not maintain any state.
  • It forgets about the client after sending the response.
  • It treats every new request independently.
  • HTTP closes the connection automatically after generating the response for each request.
  • This ensures that no client can engage connection with web server for a long time.

 

What If HTTP Is Stateful Protocol?

 

If HTTP is a stateful protocol, then-

  • It will give a chance to the browser window to engage the connection with the web server for a long time.
  • This may unnecessarily create a situation of reaching to maximum connections of a web server even though most of the connections are idle.

 

To gain better understanding about HTTP Protocol,

Watch this Video Lecture

 

Next Article- Simple Mail Transfer Protocol | SMTP

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.

DNS in Networking | DNS Resolution

Application Layer Protocols-

 

Important application layer protocols are-

 

 

  1. Domain Name Service (DNS)
  2. Hyper Text Transfer Protocol (HTTP)
  3. Simple Mail Transfer Protocol (SMTP)
  4. Post Office Protocol (POP)
  5. File Transfer Protocol (FTP)

 

In this article, we will discuss about Domain Name Service (DNS).

 

DNS in Networking-

 

  • DNS is short for Domain Name Service or Domain Name System.
  • It is an application layer protocol.

 

Purpose-

 

  • DNS is a host name to IP Address translation service.
  • It converts the names we type in our web browser address bar to the IP Address of web servers hosting those sites.

 

 

Need-

 

The need for Domain Name Service arises due to the following reasons-

 

Point-01:

 

  • IP Addresses are not static and may change dynamically.
  • So, a mapping is required which maps the domain names to the IP Addresses of their web servers.

 

Point-02:

 

  • IP Addresses are a complex series of numbers.
  • So, it is difficult to remember IP Addresses directly while it is easy to remember names.

 

DNS Resolution-

 

DNS Resolution is a process of resolving a domain name onto an IP Address.

 

The following diagram illustrates the process of DNS resolution-

 

 

The steps involved in DNS Resolution are-

 

Step-01:

 

  • A user program sends a name query to a library procedure called the resolver.

 

Step-02:

 

Resolver looks up the local domain name cache for a match.

  • If a match is found, it sends the corresponding IP Address back.
  • If no match is found, it sends a query to the local DNS server.

 

Step-03:

 

DNS server looks up the name.

  • If a match is found, it returns the corresponding IP Address to the resolver.
  • If no match is found, the local DNS server sends a query to a higher level DNS server.
  • This process is continued until a result is returned.

 

Step-04:

 

  • After receiving a response, the DNS client returns the resolution result to the application.

 

Important Notes-

 

Note-01:

 

DNS uses UDP (port 53) at the transport layer.

 

DNS uses UDP at the transport layer due to the following reasons-

 

Point-01:

 

 

Point-02:

 

  • DNS requests are very small.
  • So, they fits well within UDP segments.

 

Point-03:

 

  • Although UDP is not reliable but reliability can be added on application layer.
  • Reliability can be added by using timeouts and resend at the application layer.

 

Thus, in the end both speed and protection are achieved.

 

Note-02:

 

DNS is a connection less protocol.

 

  • DNS uses UDP at the transport layer for replying to the DNS queries of clients.
  • Therefore, it is a connection less protocol.

 

Note-03:

 

DNS is non-persistent.

 

 

Note-04:

 

DNS is a stateless protocol.

 

This is because-

  • DNS server accepts the requests, process them, resolves the query and forget about them.
  • It does not make any assumption how long this will be.

 

Note-05:

 

Mapping an IP Address onto a domain name is referred to as Inverse domain.

 

It is important to note-

  • DNS can translate a domain name onto an IP Address.
  • Also, it can translate an IP Address onto a domain name.

 

Note-06:

 

For the first time,

There is more delay in translating the domain name onto an IP Address.

 

  • Converting a domain name onto an IP Address is an extra overhead.
  • This overhead is called as DNS Overhead.
  • It causes an unnecessary delay in serving the request.
  • So, there is more delay for the first time.
  • To reduce the delay next time, IP Addresses are stored in the computer using log.
  • This avoids the DNS overhead next time and takes less time in serving the request.
  • When it gets expired, the request is again served through DNS.

 

To gain better understanding about Domain Name Service,

Watch this Video Lecture

 

Next Article- Hyper Text Transfer Protocol | HTTP

 

Get more notes and other study material of Computer Networks.

Watch video lectures by visiting our YouTube channel LearnVidFun.