Although socket is not a port but it has close relationship with port.
A socket is associated with a port, though a many-to-one relationship.
Each port can have a single passive socket, awaiting incoming connections,
and multiple active sockets, each corresponding to an open connection
on the port.
Socket
It is an endpoint of a bidirectional communication over a network.
It is associated with port. It is communication path to a port.
In a very simple term, we can represent a socket as :
Socket = IP Address + Port Number
It is just like a telephone connection (IP Address) with the extension(Port No).
Sockets are of two types :
Sockets are of two types :
Active Socket
It is connected to a remote active socket through a open data connection.
It is connected to a remote active socket through a open data connection.
Passive Socket
It does not participate in an open connection, but wait for an incoming connection.
Port
It is a logical data connection that can be used to exchange data between client and server.
It is represented through a port number starts from 0 and goes up to 65535.
There are three different categories of Port Numbers:
0 - 1023 System Ports
1024 - 49151 User Ports
49152 - 65535 Dynamic Ports
System Ports are assigned by IETF (Internet Engineering Task Force) .
User Ports are assigned by IANA (Internet Assigned Numbers Authority ).
Dynamic Ports are not assigned.
If you are interested to know how we can create Client-Side and Server-Side Sockets in java, here is a link ..
Creating Client-Side and Server-Side Sockets in Java
No comments:
Post a Comment