I have a process that waits for user input, while waiting I want to check to see if the server I'm connected to is still connected. If it has gone away I want to stop waiting. I'm using a StreamSocket in blocking mode. Currently, I'm doing a getBytes with a timeout and checking for the exception. This doesn't seem very elegant. Is there a more efficient way to handle this?