getting null while reading from SSL socket
843811Oct 19 2001 — edited Feb 7 2002I am running a socket client connected to the socket server over the firewall using SUN's SSL implementation. The client is also a RMI Server.
The client connects to the server (using socket pool) and keeps connections open. If the connection is not used within 15 minutes background thread closes it.
While client is connected it sends a request to the server and reads the response using BufferedReader.readLine(). There is always one response for one request.
I have discovered that occasionally the client sends a request and then BufferedReader.readline() receives the null instead of a valid response. This never happens if the client and the server are connected directly bypassing the firewall.
Could somebody comment on the possible reasons for receiving null instead of the valid response. The JDK comments about reaching the end of the input string cannot be easily translated by me to the real live situations.
Could somebody share some ideas on how to verify if the connection is still valid after BufferedReader.readLine() returned null.
One solution could be to ignore null returned by the readLine() and rely on SoTimeout to terminate the connection. I do not like this since it will tie up sockets and it will also have significant impact on overall performance.
The other issue with this approach is how to address similar problem with URLConnection().
I played a little bit with BufferedReader.ready but I found this function very unreliable.
I am using JDK 1.3.1 running on Windows 2000.
Thanks for the help, Kris.