A communication protocol is an agreement that specifies a common language two computers use to exchange messages. For example, a protocol specifies the exact format and meaning of each message that a computer can send. It also specifies the conditions under which a computer should send a given message and how a computer should respond when a message arrives. Different types of protocols are used in Internet such as IP and TCP. 
 
A computer connected to the Internet needs both TCP and IP software. IP provides a way of transferring a packet from its source to destination and TCP handles the lost datagram’s and delivery of datagram’s. Together, they provide a reliable way to send data across the Internet. We discuss about these protocols in brief in the following section.


Internet Protocol (IP)

The Internet protocol specifies the rules that define the details of how computers communicate. It specifies exactly how a packet must be formed and how a router must forward each packet on toward its destination. Internet Protocol (IP) is the protocol by which data is sent from one computer to another on the Internet. Each computer (known as a host) on the Internet has at least one IP address that uniquely identifies it from all other computers on the Internet. When sending or receiving data, the message gets divided into little chunks called packet. Each of these packets contains both the senders Internet address and the receiver’s address. The packet that follows the IP specification is called an IP datagram. The Internet sends an IP datagram across a single network by placing it inside a network packet. For network the entire IP datagram is data. When the network packet arrives at the next computer, the computer opens the packet and extracts the datagram. The receiver examines the destination address on the datagram to determine how to process it. When a router, determines that the datagram must be sent across another network, the router creates a new network packet, encloses the datagram inside the packet and sends the packet across another network toward its destination. When a packet carrying a datagram arrives at its final destination, local software on the machine opens the packet and processes the datagram. Because a message is divided into a number of packets a different route can send each packet across the Internet. Packets can arrive in a different order than the order they were sent in. The Internet Protocol just delivers them. It's up to another protocol, the Transmission Control Protocol to put them back in the right order. IP is a connectionless protocol, which means that there is no established connection between the end points that are communicating. Each packet that travels through the Internet is treated as an independent unit of data without any relation to any other unit of data. In the Open Systems Interconnection (OSI) communication model, IP is in layer 3, the Networking Layer.

Transmission Control Protocol (TCP)

TCP makes the Internet reliable. TCP solves many problems that can occur in a packet switching system. TCP provide the following facilities:
  • TCP eliminates duplicate data.
  • TCP ensures that the data is reassembled in exactly the order it was sent.
  • TCP resends data when a datagram is lost.
  • TCP uses acknowledgements and timeouts to handle problem of loss.

The main features of TCP are:


Reliability: TCP ensures that any data sent by a sender arrives at the destination as it was sent. There cannot be any data loss or change in the order of the data. 

Reliability at the TCP has four important aspects:
  • Error Control
  • Loss control
  • Sequence control
  • Duplication control 
Connection-oriented: TCP is connection-oriented. Connection-oriented means a connection is established between the source and destination machines before any data is sent i.e. a connection is established and maintained until such time as the message or messages to be exchanged by the application programs at each end have been exchanged. The connections provided by TCP are called Virtual Connections. It means that there is no physical direct connection between the computers.


TCP is used along with the Internet Protocol to send data in the form of message units between computers over the Internet. While IP takes care of handling the actual delivery of the data, TCP takes care of keeping track of the individual units of data (called Packet) that a message is divided into for efficient routing through the Internet. TCP provides for a reliable, connection-oriented data transmission channel between two programs. Reliable means that data sent is guaranteed to reach its destination in the order sent or an error will be returned to the sender.

For example, when an HTML file is sent to someone from a Web server, the Transmission Control Protocol (TCP) program layer in that server divides the file into one or more packets, numbers the packets, and then forwards them individually. Although each packet has the same destination IP address, it may get routed differently through the network. At the other end (the client program in our computer), TCP reassembles the individual packets and waits until they have arrived to forward them as a single file.

TCP is responsible for ensuring that a message is divided into the packets that IP manages and for reassembling the packets back into the complete message at the other end. In the Open Systems Interconnection (OSI) communication model, TCP is in layer 4, the Transport Layer.