Question

I have a chat server in C++, running in linux and using the libev libraries. If I try to connect more than 1024 clients it will crash with a -1 file descriptor.

I would like to allow more than 1024 concurrent connections to be made to the server. With looking at the libev documents it looks like it can be configured to use select, poll and epoll although I'm not sure what the default is.

Any tips or references on how to increase the limit of file descriptors using libev would be greatly appreciated!

Was it helpful?

Solution

You need to increase your allowed per-process file handles. You can allow a user to use more filehandles with this:

# Put this in /etc/security/limits.conf
someusername       soft    nofile  65535
someusername       hard    nofile  65535

(where someusername is the user that will run your program.)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top