TIMEOUT parameter for ConnectionInfo is not working (SSHClient)
Hello,
I have tried the following coding:
List<AuthenticationMethod> AuthenticationMethods = new List<AuthenticationMethod>();
AuthenticationMethods.Add(new PasswordAuthenticationMethod(username, password));
ConnectionInfo ConnectionInfo = new ConnectionInfo(IPAddress, port, username,
AuthenticationMethods.ToArray());
ConnectionInfo.Timeout = new TimeSpan(0, 0, 50);
SshClient SshClient = new SshClient(ConnectionInfo);
SshClient.Connect();
There is a failure to reach the IP address. But the time out is not respected. There is an exception after 20/30 seconds (approximately). Is there something wrong in my coding?
Thanks
PS: I have tried with the last version of SSH.NET project (development) and the official one. PS: In the definition of the project for SSH.NET, it is written: this.Timeout = TimeSpan.FromSeconds(30); PS: I have also tried the example in the SSH.NET project. It was the same result.
var host = Resources.HOST;
var username = Resources.USERNAME;
var password = Resources.PASSWORD;
#region Example SshClient Connect Timeout
var connectionInfo = new PasswordConnectionInfo(host, username, password);
connectionInfo.Timeout = TimeSpan.FromSeconds(50);
using (var client = new SshClient(connectionInfo))
{
client.Connect();
// Do something here
client.Disconnect();
}
Good evening. Is it possible to get any feedback about that question please? Also to have an example of coding for the "SCPClient and Port Forwarding" request please.
Can you post information about exception that you get?
Thanks, Oleg
Here is the information that I get:
Additional information: A connection attempt failed because the connected party did
not properly respond after a period of time, or established connection failed because
connected host has failed to respond.
An unhandled exception of type 'System.Net.Sockets.SocketException' occurred in
Renci.SshNet.dll.
SocketErrorCode : TimedOut
It is happening after 20 seconds even the timeout is set to 55 seconds like below:
SshClient.ConnectionInfo.Timeout = new TimeSpan(0, 0, 55);
Is it possible to get an update please? Any possible change for the implementation? Or do I use it wrongly?
Good evening. Is it possible to get an update please?
@boukenka please check my answer over here #183
Thanks for the clarification.