- It is a logical connecting point between a server and a client on a network.
- Each socket is given an identification number called port number.
- Port number takes 2 bytes and can be from 0 to 65,535.
- To establish a communication between a server and a client is called as Socket programming.
- We will use a new port number for each new socket.
- That means every new service on the net should be assigned a new port number.
The following table represents some port numbers which are already used by applications running in our system.
- When a socket at server side is called server socket which is created using ServerSocket class.
- Similarly a socket at client side is called as Socket which is created using Socket class.
- Both ServerSocket and Socket class are available in java.net package.