The TCP/IP protocol and how it is used to send a packet of data
Introduction
The most common protocol on the Internet is known as TCP/IP, or Transmission Control Protocol / Internet Protocol.
If two computers are going to communicate, they must use a communications protocol. This is simply a set of rules that govern how communication will take place. The two basic protocols used on the Internet are IP (Internet Protocol) and TCP (Transmission Control Protocol). Together, they are referred to as TCP/IP. TCP/IP controls how information is successfully transferred between two computers. The computer systems communicating may not be of the same hardware or the same software but so long as they use the TCP/IP, a bridge can be built between them over which information can pass. This protocol is the foundation for other protocols. So, for example, the SMTP protocol used for sending and receiving emails calls on the TCP/IP protocol to aid it sending and receiving emails. When pages are requested using http, TCP/IP has a role in the communication that takes place.
Sending a packet of data
Four layers or steps are required to send a packet of data over the Internet using TCP/IP protocol. These are:
The Application layer. Data is encoded during this step.
The Transport layer. Data is split up into packets and port number information is added.
The Network layer. This adds the IP address to say where each packet is coming from and going to.
The Data Link layer. This adds the MAC address information to specify the hardware a packet came from and the hardware it is going to.
An example of using the TCP/IP stack
Imagine you want to send the following information across the Internet:
apple banana orange grape
Application layer
We need to send the information in a format the person receiving the information can use using a recognised standard. If we use XML tags, our data now looks like this:
<fruit>apple</fruit><fruit>banana</fruit><fruit>orange</fruit><fruit>grape</fruit>
Transport layer
The data is split up into packets and the port number is added. We also need to ensure that the packets can be assembled in the correct order so we need to add the order. We'll use port 80.
| Transport header | Data |
| 80 1/4 | <fruit>apple</fruit> |
| 80 2/4 | <fruit>banana</fruit> |
| 80 3/4 | <fruit>orange</fruit> |
| 80 4/4 | <fruit>grape</fruit> |
Network layer
The network layer adds the receipient's IP address and the sender's IP address. We'll send to 104.322.8.155 and the sender's IP address will be 90.14.202.56.
| Network header | Transport header | Data |
|
104.322.8.155 |
80 1/4 | <fruit>apple</fruit> |
| 104.322.8.155 90.14.202.56 |
80 2/4 | <fruit>banana</fruit> |
| 104.322.8.155 90.14.202.56 |
80 3/4 | <fruit>orange</fruit> |
| 104.322.8.155 90.14.202.56 |
80 4/4 | <fruit>grape</fruit> |
Link layer
Finally, we'll add the MAC address of the recipient. We will use 00:34:3d:c5:2a:44. The MAC address of the sender will be 4a:22:5a:cb:b2:1d
| Link header | Network header | Transport header | Data |
|
00:34:3d:c5:2a:44 |
104.322.8.155 |
80 1/4 | <fruit>apple</fruit> |
| 00:34:3d:c5:2a:44 4a:22:5a:cb:b2:1d |
104.322.8.155 90.14.202.56 |
80 2/4 | <fruit>banana</fruit> |
| 00:34:3d:c5:2a:44 4a:22:5a:cb:b2:1d |
104.322.8.155 90.14.202.56 |
80 3/4 | <fruit>orange</fruit> |
| 00:34:3d:c5:2a:44 4a:22:5a:cb:b2:1d |
104.322.8.155 90.14.202.56 |
80 4/4 | <fruit>grape</fruit> |
We can now send the packets of data across the Internet. The packets hold enough information for them to reach their destination, find the correct computer, use the correct port, be reassembled in the correct order and be returned or confirmed if there is a problem.