tcp tutorial part 2

TCP Segment format:

The figure below show the TCP segment format. It show the different
field within the TCP header.

bit 0 bit 16 bit 32
------------------------------------------------------------------
Source port (16) Destination port (16)
________________________________________________________________

Sequence number (32)
_________________________________________________________________

Acknowledgement number (32)
_________________________________________________________________

Header Reserved Code Bits Window (16)
Length (6) (6)
(4)
______________________________________________________________

Checksum (16) Urgent (16)
________________________________________________________________

Options (0 or 32 if any)
_________________________________________________________________

Data (varies)
_________________________________________________________________

1 comment:

Shaunak said...

The TCP header is 20 Bytes long. Here's an explanation of the

different fields.



Source Port - Is the port number of the host sending the data.



Destination Port - Is the port number of the application requested

on the destination host.



Sequence number - Puts the data back in the correct order or

retransmits

missing or damaged data.



Acknowledgement number - Defines which TCP octet is expected next.



Header length (HLEN) - Defines the number of 32 bit words in the

header.



Reserved - Always set to 0



Code bits - Control functions set up and terminate a session.



Window - Is the window size the sender is willing to accept, in octets.



Checksum - Is the CRC.



Urgent Pointer - Indicates the end of urgent data.



Option - Sets the maximum TCP segment size to either 0 or 32 bits, if

any.



Data - The data sent.



It is important to note that TCP and UDP use port numbers for

communication.

Well known port numbers are below 1024.



Here are some well known port numbers:



FTP 21

TELNET 23

DNS 53

TFTP 69

POP3 110

NEWS 144