How avoid blocking of SSLServerSocket when reaching end of input data?

The SSLServerSocket below blocks in in

while ( (b = != -1 )


when the last byte of the input data was read. The same happens if the input stream is wrapped into a buffered reader, i.e. the following loop doesn't terminate:

var br = new BufferedReader(new InputStreamReader(in));

String s;

while ( (s = br.readLine()) != null )


According to Java Doc, should return -1 if the end of the stream has been reached.

Question: How can I avoid blocking when reaching the end of...

Read More »

By: StackOverFlow - 7 days ago

Related Posts