Socket FAQ-Wu

Source: Internet
Author: User

1) The client is in the fin_wait_1 state and the server is in the syn_recv state;

This is also a problem I encountered recently. The socket connection and disconnection procedures have been mentioned in the previous sections. You can refer to the previous sections;

How can this problem occur? The reason is that the client connects to the server, but the server limits the number of client access. It only listen does not have the accept action, causing the client to connect successfully each time, but the connection cannot be established, the client has done it again. If the data cannot be sent successfully, immediately closesocket and re-connect the new socket. This causes the above phenomenon. In socket FAQ 4, we can see the socket creation process. When the server listen connects to the client, it enters the syn_recv state. After listen, if a response is sent to the client, the client connection may be established, but after the client fails to send data, it will be closesocket and the client will enter the fin_wait1 State. At this time, the server does not have an ACCEPT, so there is no corresponding socket, the client does not send a response and closesocket information to the client. In this way, the client has a lot of fin_wait_1 and many syn_recv servers. This may cause other clients to be unable to connect, for example, you can turn off the client on my side and connect other clients;

Solution:

The connection of the server's accept client, based on the number of connections, if the number of connections exceeds, close this socket, so that this will not cause such a problem.

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.