What is Transmission Control Protocol?

 

TCP is a set of protocols that are used in conjunction  with Internet protocol (IP) to regulate and route the transmission of messages from one computer to another over the Internet.  The job of TCP is to receive information from the layer above, divide the information into manageable chunks called packets, add the TCP header to each packet and pass it on to the IP layer for routing to the destination.  TCP is a reliable protocol in that it checks to make sure that packets do indeed arrive at the destination and that they are not corrupted either maliciously or due to network errors.  Also there is no guarantee that the packets arrive at the destination in the proper order (this is despite of the fact that all packets have the same IP address) so one other thing that TCP does is to number the packets so that the receiver can reassemble the information. 

 

For example if you have requested a web page from a server on the Internet, TCP at the sender divides the HTML document into packets, numbers the packets.... and passes it to IP layer.

 

Also there is obviously receive functionalities at the receiving end.  TCP at the destination receives the packets from the IP layer and uses the sequence numbers to reassemble the information.  It also does some error checking and transmits confirmations of receipts to the sender.

 

What happens if a packet is lost and does not arrive at the sender?

 

 

 

 

TCP is referred to as a connection-oriented protocol.  This is because a connection is established through a handshake process and this connection is maintained and kept open for the duration of the message exchange.  We said one of the things TCP does is to break up the data into manageable packets.  Well TCP at each end communicates the maximum size of packet it can handle and the smaller is decided upon.  Having divided the data into packets, TCP adds a header to each packet.  This header is information that TCP at the receiving end needs to do its job.  The most important information in the header are the sequence number for the packet (packets do not generally arrive at destination in the right order) and port number.  TCP at the receiving end uses the sequence number to reassemble the packets into original data and check for missing packets.  Port numbers are used to keep track of conversations.   Keep in mind that you could have a number of applications open at each end, a number of which may require communication.  Under these circumstances one machine's TCP would need to handle a number of conversations.  To do this TCP at each end allocates a port number to each conversation.  One other important thing that is placed in the header is "checksum".  This is a number that is calculated for each packet.  TCP at the receiver computes its own and compares with checksum in the header.  If they don't agree, packet is declared bad.  At this point message that is passed on to the IP layer looks as follows;

 

 


           

 

 

Where do the TCP fit into the OSI?

 

 

 

 

 

User Datagram Protocol is also a transmission layer protocol.   What are the similarities and differences of UDP with TCP?