SocketTimeout behaviour
Hi all,
This is my first post and I've been looking for a response inside the class files, google and also this forum, but I haven't found a response.
I'm using the this API for adding connection timeouts to my ldap connections. My question comes when I use the setSocketTimeout method or LDAPConnection(timeout) constructor.
Inside the code, the setSocketTimeout method in the Connection class sets the SoTimeout for the Socket object.
The setSoTimeout in the Java 1.4 API says "...a read() call on the InputStream associated with this Socket will block for only this amount of time. If the timeout expires, a java.net.SocketTimeoutException is raised, though the Socket is still valid..."
So... I understand that I can hold the connection active if I'm not doing any read, or any search, delete, and so on. I have a connection pool and I need some active connections to be reused.
And my problem starts here. If I open a new connection
....
LDAPConnection ldapConnection = new LDAPConnection(timeout);
ldapConnection.connect(host, port);
....
If the connection remains idle over the requested timeout, the connection gets closed.
The question is... żIs this a Bug or is the correct behaviour?
Thanks in advance!
Discolo
|