Non blocking connect using streams/TLI?

Doug McCallum dougm at ico.ISC.COM
Mon Dec 19 13:27:33 AEST 1988


In article <488 at gonzo.UUCP> daveb at rtech.com (Dave Brower) writes:
...
>streams/TLI based connection routine?  
>
>(This is of interest in, say a window system where select is the heart
>of the event loop.  You'd want to make sure that other events coming in
>won't be blocked out by a connect request to something on a slow
>network)
>

Yes, there are a couple of ways to do it.  If all you are concerned with
is incoming connection requests, then just "poll" on the STREAM you
will receive connection requests on and do a t_listen if the poll shows
that something can be gotten from the descriptor.  The poll system call
performs much the same function as select in a BSD system.  You could
also set the descriptor to O_NDELAY and have a non-blocking descriptor.

This type of asynchronous usage is described in the documentation on STREAMS
and the man pages for the t_* functions mention it as well.

Of course, AT&T chose to allow poll to only work on STREAMS devices in V.3
based systems.  Some vendors may have extended poll to other types of file
descriptors but you can't count on it but it does work on STREAMS and TLI.



More information about the Comp.unix.wizards mailing list