The No. 519 Day of work

Source: Internet
Author: User

Two questions were verified today.

First, thebacklog is not filled to the extent that it takes effect.

Second, the main course said that the problem of landing is because the listen queue is full, causing the new connection is not connected, this argument is true.

In response to the first question, I looked at some of the data and learned that it was determined by the bottom of the operating system, and I did the following experiments on my MacBook and Windows7.

Server-side: Create socket-> fill sockaddr_in struct, bind listener address and port number->listen (socket, Somaxconn)->while (True) {;} ->end

Client: while (true) {Create Socket->connect server}->end

In the client, the count variable (count++) is printed once per connect, and after it runs, it is found that the connect is blocked at 128 on the Mac and the windows7 below is blocked by 200. So the backlog is not how much is valid, is limited, exceeding the system's upper limit, will be set according to the system's upper limit.

For the second question, I printed out the error of Connect, error 10061. The main course said 10036 Oh, but also resolute. Then I was very happy to pick him up, said I measured the queue full of errors is 10061, not 10036. Then he asked me what the hell 10061 was, and I told him it was "server denial of service." He said, he's mistaken, it's 10061!

What the heck! Fortunately I practiced it myself, or else according to what he said to find 10036, do not know to find se years.

Then we can find the problem point, the queue is full, excluding the SYN flood attack is because there is no accept, normally will not appear this problem. This is true unless the thread that is responsible for the accept is hung out. Well, look for it tomorrow and see if it's possible that the thread will hang up.


The No. 519 Day of work

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.