How can I check socket state?

+1
What’s the status of this method? Is it reliable or not?