Non blocking connect using streams/TLI?

Doug McCallum dougm at ico.ISC.COM
Tue Dec 20 10:36:24 AEST 1988


In article <12903 at ico.ISC.COM> dougm at ico.isc.com (Doug McCallum) writes:
>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)
>>

My response didn't indicate how to do this with connect although it
was hinted at.  If the STREAM obtained with a t_open() is put into
O_NDELAY mode, the t_connect() will not block.  When poll says there
is an event, a t_look (I think I said t_listen before) will indicate
if it is a response to the connect request and a t_rcvconnect can be
used to complete the connection.  Look at the t_rcv* functions for
more details.

Unlike BSD sockets, the TLI primitives have separate events/operations
for things like connect and connect response and receiving an incoming
connect indication and the actual acceptance of the connection.
Sockets tend to have more done in the calls.  One nice thing in TLI is
that after t_listen gives you the connection request you can decide to
accept or reject based on information provided by the t_listen.

For more casual programming, sockets tend to be a lot simpler.



More information about the Comp.unix.wizards mailing list