A socket is also called a socket, and an application typically makes a request to the network through a socket or answers a network request.
In Java, the sockets and Servesocket class libraries are located in the java.net package. Seversocket is used for server-side, socket is used when establishing network connection. When the connection succeeds, a socket instance is generated at both ends of the application, manipulating the instance to complete the required session. For a network connection, sockets are equal, and there is no difference, not due to different levels on the server side or on the client. Either the socket or the ServerSocket their work is done through the socket class and its subclasses.
The process of establishing a socket link:
There are three steps to establishing a socket link:
1. Server Monitoring
2. Client making a request
3. Create and Confirm links
Once the client and server have confirmed the link, the socket continues to be listening and receives and transmits information to each other.
The socket has the following features:
1.Socket based on TCP link, data transmission is guaranteed
2.Socket is useful for establishing long-duration links that do not close randomly as HTTP requests do.
3.Socket programming is typically applied to instant messaging, an application that is inseparable from its first two-point feature.
Socket communication in Java (i) socket introduction