DEV Community

Salah Ud Din
Salah Ud Din

Posted on

What is TCP/IP ? Introduction TCP/IP Packet.

Transmission Control Protocol/Internet Protocol explanation.

GitHub: Salah Ud Din - 4yub1k

Discussed:

  • OSI Model.
  • Encapsulation.
  • Internet Protocol (IP).
  • Transmission Control Protocol (TCP).
  • Duty of TCP.
  • Connection Establishment.
  • 3-Way Handshake.

Open Systems Interconnection model (OSI model):

The Open Systems Interconnection model (OSI model) is a conceptual model that characterize and standardize the communication functions of a telecommunication or computing system without regard to its underlying internal structure and technology.
Internet protocol suite

OSI model

Encapsulation:

When data is transmitted from one host to another, the data is handed downwards from the uppermost layer to the bottom layer of the sending host. At each level, the current layer adds its own header (or trailer) and hands it further downwards. This process is also called encapsulation.

At the bottom layer the data is transmitted to the receiving host in bytes, which then does the same process in reverse. Handing the received transmission from the bottom to the top with each layer removing their header (or trailer).

Layer architecture:

Layer architecture OSI Model

Internet Protocol (IP):

The Internet Protocol (IP) is the principal communication protocol. It delivers packets from one Host(IP) to other Host(IP).

It is connectionless so packet loss/corruption may occur.

Packets of connectionless protocols are also called datagrams. This falls in Internet/Network Layer.

Types:

IP Version 4 (IPv4) -> 192.168. 10.150.
IP Version 6 (IPv6) -> 3002:0bd6:0000:0000:0000:ee00:0033:6778.

Format of IP Header:

Format of IP Header

Detailed Format of IP Header:

Detailed Format of IP Header

Transmission Control Protocol (TCP):

This protocol is responsible for many application which work on internet e-g WWW, email, File Transfer Protocol, Secure Shell, peer-to-peer file sharing, and streaming media.
This Transport layer provide connectivity between HOST-HOST. It is reliable, ordered and error-checked protocol. Opposite to User Datagram Protocol (UDP).

Duty of TCP:

(Why TCP ?)

  • Establishment/termination,
  • Reliable transmission,
  • Error detection,
  • Flow/congestion control, and more of connection.

Format of TCP Header:

Format of TCP Header

Detailed Format of TCP Header:

Detailed Format of TCP Heade

Connection Establishment:

TCP uses a three-way handshake in order to establish a connection. Let’s assume that host A (Client) wants to connect to host B (Server):

3-Way Handshake:

3-Way Handshake

SYN: Client send a [SYN] to Server with a random value as sequence number “x”.

SYN-ACK: Server replies on this connection attempt by sending a [SYN ACK] . The sequence number “y” is randomly chosen by Server. The acknowledgement number is the received sequence number increased by one i.e. [PACK]=”x+1".

ACK: Client send an [ACK] to Server. The sequence number [SEQ] is the previously received acknowledgement number [PACK]=” x+1". The new acknowledgement number [PACK] is the received sequence number increased by one i.e.[PACK]=”y+1".

TCP/IP wireshark

FIN: To terminate the connection. See Flag in TCP.

We’ll discuss TCP/IP crafting in next article. [Coming soon..]

Top comments (0)