in reply to How to find out whether socket is still connected?

Out of curiosity, which docs? The docs for getpeername don't say anything about indicating whether the socket is still connected or not.

Replies are listed 'Best First'.
Re^2: How to find out whether socket is still connected?
by Anonymous Monk on May 29, 2009 at 23:50 UTC
    I confirm getpeername will do the trick. if the remote end has closed connection then getpeername will fail. RS.

      I understand this is an outdated post, but I need confirmation that getpeername is a reliable test that socket is still connected. Is there a best practice please?