3 ms·
I'm going to take a stab at interpreting what this article is about. First, the missing background: djb likes unix. the unix philosophy is to compose small p
by drudru11 13y ago
I'm going to take a stab at interpreting what this article is about.
First, the missing background:
djb likes unix.
the unix philosophy is to compose small programs together to solve problems.
djb's own programs illustrate this really well. They are all small, focused tools. This allows each program to focus on their particular task or domain.
The primary method of composition in unix is the pipe in a shell. Each pipe has two descriptors. One for read and one for write.
It is very easy to create a pipe and handle pipe IO.
The article:
At some point, djb wanted to have some programs live on the network. This expands the composition beyond a single machine. If you just try to treat a socket as a standard pipe, you encounter the problem he describes.
Any program utilizing a pipe requires two file descriptors. If someone built a trivial 'netpipe', they could just 'dup' or 'dup2' the socket file descriptor to make it look like a normal pipe. The problem with that is now the socket won't close until both fds are closed. This means the remote end won't detect EOF. This means the 'netpipe' program has to be very clever in order to detect EOF and do a proper close on both so the remote can see the last bytes and then EOF.