Are you trying to detect the case where a push of data would be replied to with a TCP packet with RST set? That happens asynchronously, so I'm not sure write() would return an error. Maybe the _next_ call to write(). You might be able to get a SIGPIPE or something.
How does one detect that a socket is being closed with Stdio.Buffer?
Marcus Comstedt (ACROSS) (Hail Ilpalazzo!) @ Pike (-) developers forum Wed, 17 Jun 2015 02:10:47 -0700