Baidu definition: The network of two programs through a two-way communication connection to achieve the exchange of data, one end of this connection is called a socket.
Socket Communication Process:
The two programs on the network realize the exchange of data through a two-way communication connection, one end of this connection is called a socket.
Server creates sockets based on address type (IPV4,IPV6), socket type, protocol
Server binds IP address and port number to socket
Server socket Listener Port number request, ready to receive the client's connection, this time the server socket is not opened
Client creates socket
Client opens socket, attempts to connect to server socket based on server IP address and port number
The server socket receives a client socket request, passively opens, and begins receiving client requests until the client returns the connection information. When the socket enters the blocking state, the so-called blocking is the Accept () method until the client returns the connection information, and begins receiving the next client understanding request
Client connection successful, sending connection status information to server
Server Accept method returned, connection successful
The client writes information to the socket
Server Read information
Client shutdown
Server-side shutdown
Socket Coarse Solution