Search code examples
javatelnet

Default timeout for Apache commons TelnetClient, java


I'm using the apache telnetclient library to connect to a switch with a telnet connection, but the problem i'm having is the setDefaultTimeout method will not work. instead of timing out in 1 second like i want,

telnetClient.setDefaultTimeout(1000);

it takes up 20 seconds to timeout. Has anyone else come across this problem?


Solution

  • Found the answer on this page http://www.ioncannon.net/java/132/connection-timeouts-with-the-apache-commons-telnetclient/. turns out it was changed to setConnectTimeout(int) instead of setDefaultTimeout(1000)