The process of creating a socket is as follows

 

TCP: The server creates a socket, binds the IP and Port, listens on connections, accepts a connection, sends and receives messages, and closes the socket. The client creates a socket, connects to the server, sends and receives messages, and close the socket.

UDP: The server creates a socket, binds the IP and Port, and receives messages. The client creates a socket, sends messages.

你可能感兴趣的:(The process of creating a socket is as follows)