Subject: Re: Obtaining client IP address before accept(2)
To: Rob Newberry <robthedude@mac.com>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 07/14/2005 21:39:48
>
> I think this is how it work.
>
> Using the STREAMS API, you:
>
> - use t_open to create a socket in non-blocking mode
>
> - use t_bind and t_listen to start waiting for incoming connections
Use t_bind() to assign a local address and say that you want incoming
connections (the CONIND_number parameter).
> - use t_look to wait for a T_CONNECT event
Then/or use t_listen to give you the incoming call message.
> At this point, you have the option of accepting the connection (using
> t_accept) or disconnecting (using t_snddis).
From the XTI/TLI/TPI point of view yes.
> t_accept will send a
> TCP_SYN and completion the open, while t_snddis will send a TCP_RST
> (since the connection is not yet open).
Neither the Lachman STREAMS TCP stack (in SVR4), nor any stack Sun have
issued [1] the SYN-ACK in response to the t_accept().
> The Mac OS STREAMS implementation (based on Mentat's code) made the
> t_look stuff a little easier by allowing you to specify a callback
> when the event came in, so it was a little easier to handle.
Actually it is almost easier to use the TPI and getmsg/putmsg directly!
Additionally that removes all the problems the XTI library has in
supporting t_sync() and t_getstate() - both of which are actually
impossible.
David
[1] To my knowledge
oh and see: www.opengroup.org/onlinepubs/9694979699/front.htm#tagcjh_01_03
--
David Laight: david@l8s.co.uk