PORTS AND SOCKET EXPLANATION

WHAT IS PORT ?

In the Internet Protocol suit, a port is an endpoint of communication in an operating system. in software it is a rational construct that classifies a particular process or a sort of network service. And it is permanently related with an IP address of a host and the protocol type of the statement, and thus finalizes the destination or origination network address of a communication session.

Port is called called as a service delivered by a machine and each and every service running with a particular or customized port (The service is recognized by a port number). There are a lot of consistent port numbers for general services.

TCP and UDP use ports to map inward data to an individual process  on a computer.ports-and-socket-explanation

PORTS NUMBER

Ports is signified by optimistic (16-bit) numeral value between 0 and 65535

The port numbers are allocated into three ranges

  • Well Known Ports  0  to  1023. Assigned & controlled by IANA.
  • Registered Ports, 1024 to 49151. Not assigned & controlled by IANA.But registered by IANA.
  • Dynamic and/or Private Ports, 49152 to 65535.Not assigned & registered by IANA

Some ports have been kept to provision shared / well known service.

  • FTP 21/tcp
  • Telnet 23/tcp
  • SMTP 25/tcp
  • SSH  22/tcp

WHAT IS SOCKET ?

A network socket is one endpoint in a statement flow in the middle of two programs running over a network, also it is maintaining and allow communication between two different processes on the same or different machines. socket address is the combination of an IP address and a port number.
In networking, a socket is used to allow many processes within a single or different host to use TCP communication simultaneously.  The socket is formed by including the IP address with the port number to uniquely identify each separate data stream.  A connection can be fully specified by the sockets at each end.
Also we call socket as type of a ‘tag’, that individually identifies and keeps a connection, such that request and reply are sent & received by the correctly mapped application running on a device.
Socket arrange for an interface for programming networks at transport layer.

Socket Address : Socket address is combination of IP address and a Port number.ports-and-socket-explanation

TYPE OF SOCKETS

Active Socket
Associated to a remote active socket through an open data connection.
Closing the association terminates the active sockets at each point.
Passive Socket
Associated, but awaits an incoming connection, which will brood a new active socket.

For more clarity , lets take an example – Think of your machine as an apartment building –

  • A port is an apartment number.
  • A socket is the door of an apartment.
  • An IP address is the street address of the building.

Some of commonality between port number and Socket is shared below –

  • Ports and sockets help identify process running on host machine uniquely.
  • When a web page is terminated automatically , the socket programs will be terminated and associated port numbers are released back.

BELOW ARE THE DIFFERENCES BETWEEN PORT AND SOCKET –

ports-and-socket-explanation

Please follow and like us:

Related Post

Add Comment

Social Media Auto Publish Powered By : XYZScripts.com
Select your currency