Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#87 Code Hangs on ssh.setSocketTimeout(10000);

open
nobody
J2SSH (50)
5
2012-02-21
2012-02-21
Sachin
No

I am having similar issue as reported by this user under review.
user: Taabish
I am facing problem with the J2ssh library in my application where it get hangs very often.
import com.sshtools.j2ssh.SshClient;
import com.sshtools.j2ssh.authentication.AuthenticationProtocolState;
import com.sshtools.j2ssh.authentication.PasswordAuthenticationClient;
import com.sshtools.j2ssh.session.SessionChannelClient;
ssh = new SshClient(); ssh.setSocketTimeout(10000);
ssh.connect(hostname, port); --->> It gets stuck at this point.
PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();
pwd.setUsername(username);
pwd.setPassword(password);
result = ssh.authenticate(pwd);

I believe the setSocketTimeout is not throwing any exception.
Can anyone please provide me with a solution. Thanks

Discussion