Introduction to TCP

TCP is Transport Layer Protocol, that provides connection-oriented, reliable, ordered and error checked delivery of packets from a program/application on one computer to program/Application on another computer. If we consider the OSI Model then TCP comes in Transport Layer, TCP takes data from Session Layer and provide it to Network Layer (IP- Internet Protocol). TCP communication is based on sockets, i.e. one socket on a computer to a socket on another computer.


Socket is simply a set of two elements 1) IP and 2) Port on a computer. I.e. IP (e.g 192.168.11.1) is used to uniquely identify the computer in network and Port (e.g. 22 of ssh deamon or 80 httpd) is used to uniquely identify and application on that computer. Now in general sense an application on one computer has it's own address (IP,Port) and address of application to which it wants to communicate (Destination IP, Destination Port).

Examples of Sockets pairs that can communicate.
1) [10.10.10.10, 5566] <--> [10.10.10.11,5566]
2) [10.10.10.10, 5566] <--> [10.10.10.10,6655] etc.

Layered View of TCP Protocol

Note:- TCP is a reliable protocol that runs of over un-reliable Internet Protocol (IP).

Here we have outlined some basic features of TCP, we shall discuss them later in detail.

1) Basic Data Transfer
TCP transmits data as stream of bytes packed into a block usually called segment in each direction between two hosts.
2) Reliablity
TCP prevents data from damage,lost,duplicated and delivered out of order. TCP assigns a unique sequence number to each octet transmitted that shall help to detect duplicate and arrange them in order. TCP expects ACK of each transmitted data stream/segment if ACK is not received in timeout interval then data is re-transmitted,Checksum is used to handled by damage in segment.
3) Flow Control
Flow is controlled by sending "window" in each ACK. "Window" is nothing but the lenght/amount of data the other host/computer expecting to receives.
4) Multiplexing
TCP allows multiple processes to use TCP on the same host/computer. Each TCP connection is uniquely identified with pair of socket. I.e. Socket(IP.Port) at one host communicates with socket(IP,Port) on another host.
5) Connections
Clock based Handshake mechanism is used to make connection between un-reliable host over un-reliable internet protocol.
6) Precedence and Security
TCP provide the mechanism of security and precedence of data.







Your Comments /Suggestions and Questions are always welcome,  shall clarify with best of knowledge. So feel free to put Questions.

No comments:

Post a Comment