Saturday, July 24, 2010

TCP Explained.

Always on Time !!..The Transmission control protocol (TCP) Provides applications with reliable ,connection-oriented service and provides full logical path between two hosts on disparate networks .

This article is an attempt to detail the different fields available in the TCP segment .

Source and Destination port :Its a 16 bit field that specifie
s the source and destination applications for the encapsulated data.


RFC 1700 describes all the ports number in common and not so-common use (http://www.ietf.org/rfc/rfc1700.txt).

A port number for an application ,which is combined with an ip address of the applications where host resides in , is called a socket .
Sequence number : Its a 32 bit identifier which identifies where the encapsulated data is fits within a data stream .
If the sequence number of a segment is 1 and the segments contains 512 octets ..the next segment should have sequence number of 1+512=513.
Acknowledgment number :Its a 32 bit field which tells what would be the sequence number the source expects to receive from destination.
If a hosts receives a acknowledgment number that doesn't match the next sequence number it intends to send , it concludes that packets earlier sent has not reach the destination and it will re-transmits the same.

Header Length :Its a data offset and a four bit field indicates the length of the header in 32-bit words and indicates the beginning of the data.

Reserved Field :Its of six bites ..which are always set to zero.

Flags :They are six 1-bit flags that used for data flow and control .
URG -Urgent
ACK-Acknowledgment
PSH-Push
RST-Reset
SYN-Synchronize
FIN-Final

Window Size: 16 bit field used for flow control .It specifies the number of octets,starting with the octet in indicated by acknowledgment number, that the sender of the segment will accept from its peer.
It specifies how much data it can handle or process at a time .


Checksum: Its a 16 bit field covering both the header and the encapsulated data,allowing error detection.
Urgent pointer :Its again a 16 bit field ..its used only when the URG Flag is set..urgent pointer added to the sequence number indicating the end of the urgent data.

Options :Optional field .One good example is maximum segment size ..which indicates what will be the maximum segment size sender is willing to accept .

The remainder of the field is padded with zeroes to ensure that the header length is multiple of 32 octets .

Here below is an example of TCP packet capture details using Wireshark

1 comment:

Bharathvn said...

Good Work Ranjan!! :)