STREAMS query

Matt Crawford matt at oddjob.UUCP
Sun Oct 13 05:58:30 AEST 1985


In article <1554 at hammer.UUCP> steveg at hammer.UUCP (Steve Glaser) writes:
>
>Actually, an example of what I had in mind here is the accept sequence
>on a passive open.  In 4.2 (TCP/IP) the syscall sequence in the server
>looks something like:
>	1. socket()	2. bind()	3. listen()	4. accept()
>
>The accept blocks till a connection request is received.  It returns
>new file descriptor representing the *open* connection.  If the server
>didn't really want to talk to somebody (say it only accepts conections
>from specific users), it would have to close the connection.  The
>client side has now seen a "connection succeed" followed by a "close
>connection".
>
>In the ISO transport layer (ISO TP4), the server has the option of
>rejecting the connection *before* the other end has seen its
>"connect()" succeed.  ...
>
>4.2 BSD does not support this cleanly. ...

I betcha two new ioctl's could give 4.2 the above functions.
Do a select() on a socket upon which you are listening and when
a connection is available apply new ioctl #1 to peek at the
address of the pending connection at the head of the listening
socket's so_q.  (Or getpeername() could be extended to provide
this information)  If the process does not want to accept it
can apply the second new ioctl to drop the pending connection.

Note that this will be useless in the INET domain because the
SYNs are ACK'd in tcp_input() whether or not accept() has been
called, so the other side sees it's connect() succeed as long
as the passive side has done a listen() and the queue of pending
connections is not full.
_____________________________________________________
Matt		University	crawford at anl-mcs.arpa
Crawford	of Chicago	ihnp4!oddjob!matt



More information about the Comp.unix.wizards mailing list