From: "Jesús Gabriel y Galán" Date: 2010-04-07T16:50:35+09:00 Subject: Re: Maximum number of sockets On Tue, Apr 6, 2010 at 10:33 PM, Brian Candler wrote: > I'd have thought that you'd hit a limit of 1024 because of fd_set (man > select). When I run your code, it stops after 1021 with: > > in `initialize': Too many open files - socket(2) (Errno::EMFILE) > > This is ruby 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] > from Karmic. Did you increase the ulimit for file descriptors for your process (I did ulimit -n 50000)? > I suspect you have managed to go 8 bytes beyond the limit (1024+64=1088) > before overwriting something important and killing the ruby interpreter > - presumably the newer 1.8.7 I have fixes this. > > To go beyond this limit you may need to use something like eventmachine > which uses poll/epoll instead of select. But who is calling select in my code? I'll take a look at the implementation of the socket class, although my C is a bit rusty. I just create the sockets and connect to a server, I don't want to read from them or anything (yet). Jesus.