New Understanding of TCP/IP protocol (2) listen and accept in TCP/IP if listen and accept occupy the same port, the connection listening process and creation process use the same state machine. The connection establishment process is mainly reflected in the accept system call. listen is only equivalent to setting a flag. All attempts to connect to this application must check the connection status, if the connection has been established successfully, you can directly send the data to the select/epoll/poll monitoring set. This may be the role of listen; if the connection is not established successfully, or the first connection or three handshakes are processed by accept. accept queries the state machine of the current connection for proper processing. Once three handshakes are performed, then it can be transferred to the select/epoll/poll monitoring set. The buffer zone in TCP/IP and the buffer zone in the queue TCP/IP and the queue are the buffer zone of the socket Descriptor (sending and receiving) and the message queue of the socket descriptor, it is not the receiving/sending buffer and message queue of the port. The TCP/IP descriptor is sometimes used as a server or client to enable the socket descriptor, which is in/etc/sysconfig/limits. conf; when the machine acts as a client to connect to a server, it can only open up to 65536 sockets, the establishment of a connection will occupy a port, the port in TCP/IP protocol is represented by a 2-byte int, and the maximum value is 65536. As a server, 2 ^ 48 client connections can be allowed theoretically. Of course, this is the number of connections allowed by the server on a specific port. 2 ^ 48 = 2 ^ 16*2 ^ 32, which is the combination of {remote_ip and remote_port.