Almost all the datas are transmitted using either the TCP/IP or UDP protocols. I will briefly discuss about the TCP/IP and UDP structures and the IP addressing system in this article.
Let’s first start with the IP address - Each system in the internet ( or in private network) is recognised by an unique no. and this no. stores important informations about the network and the type of service. TCP/IP has three different levels of addressing :
- Physical (Link) address – 6 bytes – This address determines the host system on a prticular network and can be either unicast(Single recipient) , Multicast(a group of recipients) or broadcast(received by all in network).** Not all networks support these, but Ethernet does.
- Internetwork (IP) address – 4 bytes – This address can uniquely identify a host connected to the Internet. No two hosts in the Internet can have the same address. Internet address also supports unicast,multicast and broadcast addressing.
- Transport or Port address – 2 bytes – The above two addressing system identifies the host but not the process to which the data actually corresponds to. For this a port address is used. e.g. Telnet uses port 23.
Each Ip address has two parts, netid – which identifies the network , hostid – identifies the host in that network. To make the 32 bit ( 4byte) more compact and easier to read and remember, IP address is written ( usually) in decimal format with decimal points separating the bytes. Five different IP address classes ( A.B,C,D and E) are used which are designed to cover the needs of various organisations.
- Class A – The first bit is 0 , first number is between 0 – 127, Private network address – 10.0.0
- Class B – The first 2 bits are 10 , first number is between 128 – 191, Private network address – 172.16 to 172.31
- Class C – The first 3 bits are 110 , first number is between 192 – 223, Private network address – 192.168.0 to 192.168.255
- Class D – The first 4 bits are 1110 , first number is between 224 – 239
- Class E – The first 5 bits are 1111 , first number is between 240 – 255, Reserved network.
Now that I have mentioned about Private Networks , it is essential to discuss a bit about it. To connect to the internet, it is necessary that the organization gets a unique netdid. It is not necessary to get the unique netid if you donot want your network to be a part of the internet. In this case, you can get your unique netid but still not connect to internet but save it for later use. However, the Internet authorities have reserved3 blocks of address for such purpose, as mentioned above.
The above figure illustrates the relationship between the different layers in the Network.
We shall now concentrate on the two protocols, TCP and UDP.
Transmission Control Protocol or TCP provides a reliable, stream oriented and error and flow control mechanism between computers. ** TCP provides full duplex service, meaning that data can flow in both directions at the same time when two application programs are connected. e.g. Data can travel from A to B and B to A at the same time, also the packets coming from B to A can carry acknowledgements of the packets received by B that was sent from A. This is called piggybacking. Unlike the IP or UDP (where it is called datagram) an unit of data that is transmitted is called TCP segment. Each TCP segment has two parts, the Header and the Data. The Header part of the TCP segment looks like :

URG : Urgent pointer is valid
ACK : Acknowledgement is valid
PSH : Request to push the data
RST : Request to resent the connection
SYN : Synchronize the sequence numbers
FIN : Request to terminate connection
In TCP the connection is established using a process which is popularly known as a Three way Handshaking. The process is as follows :
- Host A sends a segment to announce its wish to connection and includes its initialization information about the traffic
- Host B sends a segment to acknowledge ( confirm) the request of A
- Host B sends a segment that includes its initialization information about traffic from B to A
- Host A sends a segment to acknowledge the request of B.
Now that the connection is established and the datas are transferred at a point of time it would require to terminate the connection. The connection termination process in TCP is known as Four way Handshaking and is as follows:
- Host A sends a segment to announce its wish to connection termination
- Host B sends a segment to acknowledge ( confirm) the request of A. The connection is closed in A to B direction, but not the other. Host B can continue to send data to A
- When Host B has finished, it sends a segment to indicate that it wants to close the connection.
- Host A acknowledges( confirms) the request of B.
Error Control in TCP is achieved using checksum , acknowledgement , and time-out. Time-Out is the duration for which the sending TCP waits for the acknowledgement , after which it considers the data sent is either corrupted or lost and retransmits the same. Each segment includes the checksum field ( refer to the Header figure above) , which is used to check for the corrupted segment. If it is corrupted, it is discarded by the destination TCP.
User Datagram Protocol or UDP provides process-to-process communication instead of host-to-host communication and is a connectionless and unreliable transport protocol. If reliability is not important criteria, then the UDP is useful as it can transfer data faster and is used for bulk transfer. The UDP Header is of 8 bytes only and looks like

The arithmetic behind the Checksum computation is same as in the IP checksum computation. However UDP checksum calculation is different from the one for IP and ICMP. Here the checksum includes three sections :
- Pseudo Header : is a part of the header of the IP packet in which the user datagram is to be encapsulated for transmission with some fields with 0s.
- UDP Header : Header for this UDP datagram
- User Data : Data sent by the upper layer
The Pseudo header is added to ensure that the user datagaram reaches the intended process which uses the intended transport protocol on the intended host. The figure below illustrates the fields used in checksum

Checksum calculation at host
- Add the pseudo header to the UDP user datagram
- If the total no. of bytes are not even, add one byte of padding (all 0 s) , this is only for calculation and is discarded afterwards
- Fill the checksum field with all 0s
- Divide the total bits into 16 bit words section.
- Add all 16 bit sections using one’s complement arithmetic
- Takes ones complement of the result (change 0s to 1s and the original 1s to 0s), which is a 16 bit checksum no.
Checksum calculation at destination
- Obtain the IP header, derive the pseudo header from it, and add it to the UDP user datagram.
- Add padding if needed.
- Divide the total bits into 16-bit sections.
- Add all 16-bit sections using one’s complement arithmetic.
- Take one’s complement the result to get the checksum.
Many processes can use the service of the UDP and TCP simultaneously. This is achieved by the used of unique numbers to identify the process which is called as port numbers and using the concept called multiplexing and demultiplexing.
November 5th, 2011
Sanjib 

Posted in
Tags:
Recent Blogroll Additions……
[...]usually posts some very interesting stuff like this. If you’re new to this site[...]……
Online Article……
[...]The information mentioned in the article are some of the best available [...]……
Am a fresher in MCSE and CCNA, i am so thankful i found this site. superb explanation with images.
http://go4download.com/