Just more asynchronous stuff!
Alright, so I now have a working asynchronous socket program for my main chatting application, and it’s working really well! However I have one concern..
While using select() what is the maximum number of file descriptors that I can use in each set? I’ve read about a limit of 1024…
If that limit is indeed hard coded and I can’t FD_SETSIZE the limit any higher, should I spawn another thread once I reach that limit? Or something else? Is this even a concern?
Yes, the FD_SETSIZE has a limit of 1024. You can easily check that by looking at the select.h header. People have tried to increase the limit, but the reports vary from “working” to “crashing” after a while. If you need that many connections, use
pollinstead.A very good article to read.