3 ms·
shutdown(2) lets you report EOF while still reading from a socket, so you can cleanly receive your peer's messages and EOF. Pipes only support close(2), so you
by prodigal_erik 17y ago
shutdown(2) lets you report EOF while still reading from a socket, so you can cleanly receive your peer's messages and EOF. Pipes only support close(2), so you can't report EOF without forcing your peer to handle SIGPIPE/EPIPE as well as ignoring anything else they want to send. And if your peer is writing and doesn't expect reads to work also (POSIX doesn't call for it), your own writes are just going to block and never be read.