[TUHS] sockets (was Re: First appearance of named pipes)

Derek Fawcus dfawcus+lists-tuhs at employees.org
Tue Mar 24 19:47:10 AEST 2020

On Mon, Mar 23, 2020 at 10:49:43AM +0200, Peter Pentchev wrote:
> On Mon, Mar 09, 2020 at 05:22:57PM -0600, Grant Taylor via TUHS wrote:
> > On 3/8/20 9:13 AM, Derek Fawcus wrote:
> > > Now what would have been useful is a way to have distinct fd's for the
> > > local read and write end of (e.g.) a TCP socket - such that one
> > > direction could be closed w/o closing the other.
> > 
> > I believe that this can be done, now.  At least I've read that it's possible
> > for one end to close (FIN) a TCP connection without the other end also
> > closing.  Thus you end up with the one-way data flow that is still ACKed the
> > way that TCP does.
> Yep, in the next sentence Derek mentioned "dispense with shutdown",
> meaning the shutdown(2) syscall that does exactly that. What he meant
> was, wouldn't it be nice to be able to do that with close(2) instead?


One point being that one could fork/exec a program with those fd's attached
to stdin/stdout and it could operate as a normal filter, w/o having to
understand it was using a socket.

(i.e. closing stdout [hence triggering a FIN], while still reading from stdin)

Plus various other games achievable by replumbing fd's.


More information about the TUHS mailing list