Socket vs Port
What is Socket Port?
A socket port 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.
Related – IP Address vs 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 a 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 the transport layer.
Socket Address: Socket address is a combination of IP address and a Port number.
TYPE OF SOCKETS
Associated to a remote active socket through an open data connection.
Closing the association terminates the active sockets at each point.
Associated, but awaits an incoming connection, which will brood a new active socket.
For more clarity, let’s 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 the 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.
What is Port Socket?
In the Internet Protocol Suite, a port socket 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 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 are 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
Related – Switchport Access Mode VS Trunk Mode
Comparison table: Socket vs Port
|"Port" is a number used by a particular software. The same port may be used in different computers/servers running same software.||Socket is combination of “Port” and “IP address” to identify particular software and particular computer/Server
|A socket is an end point of a bidirectional communication that occurs in a computer network that is based on the Internet protocol||A port is a logical data connection that can be used to exchange data without the use of a temporary file or storage
|Ports operate at the Transport layer of the OSI||Sockets are a means of plugging the application layer in
|Port is request running on that socket and port uses socket to deliver the packet to correct application.||A socket is the way a server and a client keep track of requests.
|A port functions like a telephone number, identifying the machine and giving the socket an area to connect.||While the socket functions like a cord that ties the computers together.
Download the above difference between Socket and Port table here.