skip to main |
skip to sidebar
Socket
- A socket is a communication channel, which facilitates inter-process communication (For example communicating between two JVMs, which may or may not be running on two different physical machines).
- There are two kinds of sockets: The connectionless communication protocol of the Internet is called UDP (datagram sockets). The connection-oriented communication protocol of the Internet is called TCP.
- Each socket is uniquely identified on the entire Internet with two numbers: 128-bit integer called the Internet Address (or IP address) and a 16-bit integer called the port of the socket.
- The port numbers 0 to 1023 are reserved for standard services such as e-mail, FTP, HTTP etc.
- The lifetime of the socket is made of 3 phases: Open Socket-->Read and Write to Socket-->Close Socket. In Java you can use the Socket (client side) and ServerSocket (Server side) classes.