in reply to How to find out whether socket is still connected?
In the general case, there's no way of checking whether a socket is connected without actually writing to or reading from it.