In TCP socket programming, there is a feature that allows to shutdown socket only one way, where data cannot be read from the socket, but it can still be written to. I've seen it referred as "shutdown for writing", or less commonly, "half-close". In this mode, a peer issues shutdown(SHUT_WR)
. The other side receives 0 bytes when doing read()
, but it can still succesfully write to the socket and the other peer can read from it.
Now, I am trying to implement a SOCKS proxy server and I wonder if there exists an actual real-life protocol that utilizes this "half-close". From what I see, most implementations of proxy servers just close()
both sides of the tunnel once read()
ing 0 bytes from either of the sides. Everything seemingly works when doing it that way.
Are there actual real-life uses of this option or can I safely ignore it when implementing my proxy server?