Difference Between Socket and Port

Socket and port are two of the most important hardware equipments which are used in computer networking. Although, both of them are used synonymously, but there is a considerable difference between the two. A socket is attached with a port and is an end point of two-way communication which occurs within a computer network on IP. On the other hand, a port is just a logical data connection which assists in transferring data files between different computers through a network.

Normally, only one socket is attached with a port. However, sometimes there can be multiple sockets attached with a single port.

Instructions

  • 1

    Socket

    It is referred to as an end point of a bidirectional communication which happens in a computer network that is completely based on IP (internet protocol). It distributes the data packets which come to the correct application from the communication channel. Operating system of the computer maps every socket to a thread or a process which eventually communicates.

    There are mainly two types of sockets namely active sockets and passive sockets. In active socket, communication channel is destroyed when the connection ends. On the contrary, a passive socket doesn’t take part in any kind of connection, but waits for an incoming connection. Furthermore, when the passive socket is attached to an application it generates a new socket that is active.

    An internet socket is recognized by transport protocol (e.g. UDP or TCP), remote socket address and the local socket i.e. port number and local IP address.

    Image courtesy: forum.bodybuilding.com

  • 2

    Port

    It is a logical data connection which is used to exchange data files without using any kind of temporary storage or file. TCP and UDP are the most extensively used ports which are used to transfer data between PCs.

    Additionally, it is recognised by using the transportation protocol, IP address and different numbers which are associated with the port - known as port number.

    It is to be noted that the arrangement of port numbers is mostly reserved in a computer which is hosting the whole service. Besides, the process of connecting a group of ports which have a specific sequence, is known as port scanning.

    Generally, the process of port scanning is deemed as malicious as it may damage the data files of the computer. Therefore, the administrators always keep an eye on the networking activities so as to protect it from any viruses or malicious software.

    Image courtesy: commons.wikimedia.org

Leave a Reply

Your email address will not be published. Required fields are marked *


eight + 8 =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>