(1) socket Concept
For inter-network process communication, the two processes must be uniquely identified. The "ip address" at the network layer can uniquely identify the network host. The "IP + port" at the transport layer can uniquely identify the two processes on the network.
After two processes are identified, socket is usually used for communication.
The socket originated from UNIX and continued the concept of "Everything is a file". It uses the "Open-read-write-close" file operation method.
Shows the relationship between the socket layer and the application layer.
(2) socket communication process
Server: socket-> bind-> listen-> Accept-> receive-> close
Client: socket-> connect-> send-> close
The server needs to obtain the IP address and the bound port number for the client to call. Therefore, bind and listern are required. The client port number is bound to the port number during connect.
(3) socket connection establishment process
Establish a connection with the three-way handshake of TCP/IP
Using the packet capture tool, you can see the three handshakes of my visit to the blog http://blog.csdn.net/wangpeifeng669.
(4) socket release process
Release connections four times
For Java Socket Connection demo, refer to here
From:
Http://blog.csdn.net/dlutbrucezhang/article/details/8577810
Http://www.cnblogs.com/dolphinX/p/3460545.html
Computer network-socket Overview