How can i find out if a socket is closed/unused or if it needs to be closed?
How can i find out if a socket is closed/unused or if it needs to be closed?
http://livebad.com/nuka
Da-Nuka
Hmm... one way of doing it is to call setsockopt() on the socket. If you get the error EBADF, then you know the socket descriptor is no longer valid (ie it's been closed, or it was never opened in the first place).
One solution is select().
Kuphryn