1024 limit is not just the number of listeners, or the maximum value of the file descriptor, note that the value
Today, a mock client program is written to test and a select is used. The previous error is 1024 is the fd_set of the number of FD limit (my program is every time you select a FD, so I feel no problem), the result of the socket connection number reached 1050~1100, the total occurrence of a segment errors.
Look at the core file, repeatedly clear the process of thinking, can not find the problem point. What's even more puzzling is that by annotating part of the code (all of which are local variables), the resulting program becomes a segment error when the socket connection reaches about 1500.
Later thought to try is not a select problem, the simulation program does not call Select, all using blocked sockets, the results test to 10,000 socket connections are not a problem.
In the end, I see that the maximum value of the FD value in select is Fd_setsize (1024 in my environment), not the number.
There are also objections, such as a select for a value of 1025 for FD is no problem. I did not test it, but in my case, with a select of more than 1024 FD, the problem cannot be immediately exposed (I have been to 1500), but there may be
Issues such as cross-border access (segment fault).
Had not been thought of before, has always thought is similar to the ulimit limit has not changed. But the contradiction is the same configuration, with Poll/epoll write service end can test to more than 10K, now finally clear.
1024 Limitations of Linux under Select