I'm in the midst of writing a MUD for PDP-11s running under BSD 2.11
and have run into a problem getting non-blocking I/O working.
I initially wrote a simple test program to setup a non-blocking socket
and accept connections then echo back anything typed to all connected
sessions. This worked fine. However now I've placed the exact same
code into my MUD development, the sockets are blocking.
I've got the following in my setup of the socket:
/* Set socket to non-blocking */
if( ioctl(s,FIONBIO) == -1 ) {
printf("Error ocurred");
}
which I believe should make the socket non-block and when I run up the
code it doesn't throw a failure on the ioctl, however the socket
definitely remains in blocking mode.
Anyone have any ideas? I've been scratching my head on this one for days now
I've put all the source I've written thus far here:
http://www.pdp11.co.uk/wp-content/retromud/
Sorry if the code is a bit cludgy, but I've not programmed C for about
15 years and its only just coming back to me! The file comms.c is
where most of the socket actions occurs.
All the best,
Toby