[comp.unix.internals] Can you partially shutdown

Andrew.Vignaux@comp.vuw.ac.nz (Andrew Vignaux) (04/07/91)

In <1991Apr02.101330.22133@comp.vuw.ac.nz>, I wrote:
> Can I shutdown(,1) an AF_UNIX socket so that it propagates the
> "end-of-file" indication to the other end?  I seem to be able to do this
> with AF_INET sockets.  Am I asking too much from shutdown()?
> [excessively long example program deleted]

The 4.3 "Devil" book has a justification for this on page 320,
Socket-to-Protocol Interface:

: * PRU_SHUTDOWN: Shut down socket data transmission.  This call is
:   used to indicate that no more data will be sent.  The protocol
:   may, at its discretion, deallocate any data structures related to
:   the shutdown% and/or notify a connected peer of the shutdown.

So, it seems that it's up to the protocol handling code.  Why is the
"may, at its discretion" qualification there though?  To handle
protocols that you can't partially shutdown()?  Are there any (stream)
domains where it is hard to notify a peer of the partial shutdown?  Is
AF_UNIX really such a domain?

Without being able to shutdown() one side of a socket is there much
useful work you can do with socketpair()@ that you can't do (more
portably) with pipe()s#?  Actually I can partially answer that myself
(again): datagrams and passing access rights.

Andrew
-- 
Domain address: Andrew.Vignaux@comp.vuw.ac.nz

% Should that be some other word than shutdown, e.g. socket to be
  shutdown?

@ I could find only one program that used socketpair() (in the portion
  of our source archive that happened to be uncompressed) and it
  seemed to be in a routine which usually used ptys.

# When another domains/types/protocol combination acknowledges the
  PRU_CONNECT2 request this question shall be considered null and
  void.