Socket in Transport Layer

For Complete YouTube Video: Click Here

In this class, we will try to understand Socket in Transport Layer.

We have already discussed the concept of port numbers in our previous class.

Socket in Transport Layer

We have discussed that the objective of the transport layer is to provide process-to-process communication, which can be achieved by port number.

In practice, process-to-process communication can not be achieved by port number alone.

To understand how we can achieve process-to-process communication, consider the image below.

Socket in Transport Layer 1
Socket in Transport Layer 1

The above image shows three clients communicating with the http server.

We have already discussed that the range of dynamic port numbers is from 49151 – 65535.

For example, assume that C1 and C2 have generated random port numbers 53567 and 59346.

Socket in Transport Layer 2
Socket in Transport Layer 2

The data transmitted by C1 will communicate only through the 53567 and 59346 port numbers.

C3 wants to communicate with the server and has generated port number 53567.

There is a conflict that C1 and C3 have the same port numbers.

With the conflict generated server cannot recognize the processes uniquely.

Instead of port numbers, we will consider IP addresses to achieve process-to-process communication.

Assume the IP addresses of the clients are IC1, IC2, and IC3.

Socket in Transport Layer 3
Socket in Transport Layer 3

For example, there will be a conflict if C1 wants to communicate with the same server on two different browsers (Chrome & Firefox).

The process-to-process communication in the transport layer is achieved by using a socket.

A socket is a combination of Port number and IP.

A socket is separated by a colon, as shown below.

IPC1:53567.

With this, there will be no conflict, and we can achieve process-to-process communication.