Can you partially shutdown() a UNIX domain socket?
Andrew Vignaux
Andrew.Vignaux at comp.vuw.ac.nz
Sun Apr 7 09:44:25 AEST 1991
In <1991Apr02.101330.22133 at 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 at 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.
More information about the Comp.unix.internals
mailing list