[MUD-Dev] How to support 1000+ simultaneous connections, and some philosophy.
cg at ami-cg.GraySage.Edmonton.AB.CA
Wed Mar 10 21:00:37 New Zealand Daylight Time 1999
>I don't mind researching and reading man pages, but could you give
>me some hints as to how this is done? Does it involve forking?
>Something special to do with sockets? How does the handoff occur?
It was at work we did this, so I might get some details wrong. Under
BSD-style, you use the 'control' stuff in 'sendmsg', 'rcvmsg'. You just point
to the int fd you want to pass/get and use a length of 4. Beware, since you
are passing a stream of bytes, its remotely possible for not all 4 to get
there at once. The system knows what it is doing and will translate the fd
number in the sending process into a new one in the receiving process. The
sender should then close the socket so as to reduce its fd count.
... checking man pages here on Linux ...
Hmm. 'sendmsg' not implemented in Linux 0.99.11. Waaaaay back! That doesn't
say anything about Linux 2.0.30, etc! See SCM_RIGHTS in 'rcv' man page.
For SYSV-style sockets, it is ioctls on sockets that do it. You open
a UNIX-domain socket (attached to a file path) in each process and use
special ioctl's to pass an open fd from one to another. I can't find
info on it here on Linux, but it was something like SIOSNDFD/SIORCVFD or
something. Email me at cg at myrias.com and I can get you sample sources.
This question came up before, so if you search the archives, you might
find more details, like whether or not Linux supports this. It *is*
supported in SunOS4, Solaris, AIX and HP-UX, although all except SunOS4
use the SYSV method, which I can't remember or find much about right now.
Don't design inefficiency in - it'll happen in the implementation.
Chris Gray cg at ami-cg.GraySage.Edmonton.AB.CA
MUD-Dev maillist - MUD-Dev at kanga.nu
More information about the MUD-Dev