select()的最大插座 [英] select() max sockets
问题描述
只是更异步的东西!
好吧,所以我现在有一个工作的异步接口方案,我主要的聊天应用,它的工作真的很好!但是我有一个担心。
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..
虽然使用select()什么是我可以在每一组使用的文件描述符的最大数量?我读过有关1024的极限......
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...
如果该限制,的确难以codeD,一旦我达到这个限制,我不能FD_SETSIZE任何更高,我应该产卵另一个线程的限制?或者是其他东西?这是甚至担心?
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?
推荐答案
是的,FD_SETSIZE有1024的限制,您可以方便地查看通过查看select.h头。人们试图增大限制,但是从报告的工作到崩溃了一段时间后会有所不同。如果你需要很多的连接,使用调查
代替。
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 poll
instead.
这篇关于select()的最大插座的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!