New Understanding of TCP/IP protocol (2)

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.