The machenism of the socket communication.
1. Server End
2. Client End
1. Server End:
1). create a new socket, then binds it to a tuple of (host, port);
2). listen to this socket all the time, once connection comes, receive messages, and then sends out responses.
3). after communication, close this socket.
2. Client End:
a). get the target server information on hostname or ip, and the port;
b).create a socket, and connect to target server.
c). send message to server via socket, and receive response from server.
d). close socket after the transports.