SSH.NET Server requirements / SftpClient.Connect timeout

Aug 17, 2013 at 10:15 AM
I am brand new with the use of SSH.NET, but I fail on the very basics of connecting to SftpClient.Connect:
            using (SftpClient sftp = new SftpClient(Properties.Settings.Default.FTPServer, 21, Properties.Settings.Default.FTPUser, Properties.Settings.Default.FTPPass))
            {
                try
                {
                    sftp.Connect();
                    return sftp.ListDirectory(pPath);
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    sftp.Disconnect();
                }
            }
I receive a SshOperationTimeoutException with a 'Socket read operation has timed out' message.

If i remove the port, I receive a SocketException with a '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 <<IP-ADDRESS>>' message.

I have no problem logging on with FileZilla or directly in Windows Explorer.

Is it because the server miss something? I can't seem to find any other settings that should have any impact on the result. The server is my Webhotel, so I do not have full control over it.
Aug 17, 2013 at 4:06 PM
You are trying to use SFTP on a FTP port.
This can't work!
Aug 17, 2013 at 7:01 PM
Ups... Just to be sure, I tried with port 21 too, but forgot to change it back before copying the code. But, even with port 22 (or none), I still receive a timeout exception.
Aug 17, 2013 at 8:40 PM
Is a SSH server running on the target Maschine?