Is it possible to listen file descriptor greater than 1024 with select?

Although there are some ways to increase this limit (because of you’re using Linux, everything is possible), select() call can only listen 1024 file descriptor at the same time and all of the file descriptor number must be less than 1024

This limit related to how select() works. When you set file descriptor number for example 65 in fd_set structure, you’re setting 65th of bit in a vector which has 1024 bits in total. So, you can’t set file descriptor 1024 and above because there are no corresponding bit in structure.

On the other hand, if number of file descriptors you want to listen in same time is more than 10, it is suggested to use poll() or epoll() mechanism. They don’t have limits like select and unlike select, their performance not changed significiantly when number of listening file descriptor numbers high.