# Protocols

• Protocols are set of rules that help in governing the way a particular technology will function for communication.
• It defines standard for enabling the connection communication and data transfer between two computers on a network.
• It is a set of rules for message exchange among computers.

## Requirements

1. Data formats for Data Exchange:
• Header | Data
2. Address Format for Data Exchange
4. Routing
5. Detection of Transmission Errors
6. Acknowledgement
7. Loss of Information (Handling)
8. Sequence Control
9. Flow Control

## Types of Protocols

### Basis of State

1. Stateless Protocol - HTTP, UDP
2. Stateful Protocol - TCP, FTP

### Basis of Layer

1. Transport Layer - TCP, UDP
2. Application Layer - HTTP, FTP

## Some Protocols

1. Transmission Control Protocol (TCP)
2. Internet Protocol (IP)
3. User Datagram Protocol (UDP)
4. Post office Protocol (POP)
5. Simple mail transport Protocol (SMTP)
6. File Transfer Protocol (FTP)
7. Hyper Text Transfer Protocol (HTTP)
8. Hyper Text Transfer Protocol Secure (HTTPS)
9. Telnet

### Transmission Control Protocol (TCP)

TCP is a popular communication protocol which is used for communicating over a network. It divides any message into series of packets that are sent from source to destination and there it gets reassembled at the destination.

### Internet Protocol (IP)

IP is designed explicitly as addressing protocol. It is mostly used with TCP. The IP addresses in packets help in routing them through different nodes in a network until it reaches the destination system. TCP/IP is the most popular protocol connecting the networks.

### User Datagram Protocol (UDP)

UDP is a substitute communication protocol to Transmission Control Protocol implemented primarily for creating loss-tolerating and low-latency linking between different applications.

### Post office Protocol (POP)

POP3 is designed for receiving incoming E-mails.

### Simple mail transport Protocol (SMTP)

SMTP is designed to send and distribute outgoing E-Mail.

### File Transfer Protocol (FTP)

FTP allows users to transfer files from one machine to another. Types of files may include program files, multimedia files, text files, and documents, etc.

### Hyper Text Transfer Protocol (HTTP)

HTTP is designed for transferring a hypertext among two or more systems. HTML tags are used for creating links. These links may be in any form like text or images. HTTP is designed on Client-server principles which allow a client system for establishing a connection with the server machine for making a request. The server acknowledges the request initiated by the client and responds accordingly.

How HTTP track the progress of the user from page to page?

HTTP is a stateless protocol.

1. A stateless protocol doesn't require server to retain information or status about each use for the duration of the multiple request.
2. HTTP has HTTP cookies. Cookies allow the server to track the user state, the number of connections and last connection etc.
3. HTTP has a persistent connection(keep-alive) where several request can be sent from the same TCP connection.
4. But some web apps may have to track the users progress from page to page. Solutions for these cases: