Thanks Dave, the fixed it.
All the best,
Toby
On 28 February 2010 15:32, Dave McGuire <mcguire at neurotica.com> wrote:
On Feb 28, 2010, at 5:52 AM, Tobias Russell wrote:
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
?FIONBIO takes an argument, which is a pointer to an integer. ?Here's how
you want to do this under 2.11BSD:
-------------------------
?int on = 1;
...
...
...
?if (ioctl(s, FIONBIO, &on) == -1) {
? ?printf("ioctl() failed\n");
?}
-------------------------
? ? ? ? ? ?-Dave
--
Dave McGuire
Port Charlotte, FL
--
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.
--
Tobias Russell
Managing Director
Coreware Ltd
The Tannery, Tannery Lane, Bramley, Surrey, GU5 0AB, England
Email - toby at coreware.co.uk
Telephone - +44(0)1483 890910
AOL Messenger - tobystatz
MSN Messenger - tobiasrussell123 at
hotmail.com
Skype - tobiasrussell
For emergency support, telephone +44(0)871 288 0335, email
ops at coreware.co.uk, or visit
http://support.coreware.co.uk/