Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO
0 votes
1.7k views
in FAQ: edtFTPnet/PRO by (190 points)

I try to connect to an FTP server via SFTP using SecureFTPConnection from my development PC.

The connect attempt times out after 10 s, and a System.IO.IOException is thrown. No FTPException as I would expect.

It may seem this error does not occur on another PC.

I have turn on LogToTrace, and my output window in VS2015 contains these messages:

INFO [LicenseProperties] 28 nov 2016 15:04:05.995 :  Production license
DEBUG [SSLFTPClient] 28 nov 2016 15:04:05.996 :  Connecting to 157.237.87.57:21
DEBUG [SSLFTPControlSocket] 28 nov 2016 15:04:05.996 :  waitOnShutdownSSL=True
DEBUG [ExFTPControlSocket] 28 nov 2016 15:04:05.997 :  Created control-socket: SocksContext=, ProxySettings=NoProxy, RemoteHost=157.237.87.57, controlPort=21, timeout=10000
DEBUG [FTPControlSocket] 28 nov 2016 15:04:05.997 :  StrictReturnCodes=True
DEBUG [HostNameResolver] 28 nov 2016 15:04:05.997 :  Resolving DEBUG [HostNameResolver] 28 nov 2016 15:04:06.010 :  157.237.87.57 resolved to 157.237.87.57
DEBUG [ExFTPControlSocket] 28 nov 2016 15:04:06.010 :  Connecting directly to ftp-server 157.237.87.57:21
INFO [SSLFTPSocket] 28 nov 2016 15:04:06.010 :  Connecting to 157.237.87.57:21 with timeout 10000 ms
157.237.87.57
DEBUG [HostNameResolver] 28 nov 2016 15:04:06.010 :  157.237.87.57 resolved to 157.237.87.57
DEBUG [ExFTPControlSocket] 28 nov 2016 15:04:06.010 :  Connecting directly to ftp-server 157.237.87.57:21
INFO [SSLFTPSocket] 28 nov 2016 15:04:06.010 :  Connecting to 157.237.87.57:21 with timeout 10000 ms
ERROR [SSLFTPSocket] 28 nov 2016 15:04:16.014 :  Failed to connect to 157.237.87.57:21 within timeout 10000 ms
Exception thrown: 'System.IO.IOException' in edtFTPnetPRO.dll
Exception thrown: 'System.IO.IOException' in edtFTPnetPRO.dll
Exception thrown: 'System.IO.IOException' in edtFTPnetPRO.dll
ERROR [SSLFTPSocket] 28 nov 2016 15:04:16.014 :  Failed to connect to 157.237.87.57:21 within timeout 10000 ms

So, here are two things:

Why does SecureFTPConnection try port 21? Should it not be 22? If I force use of port 22 by setting <connection>.ServerPort to 22, I get the same result, though.

Why does the connect fail while an sftp connect using WinSCP works just fine?

LogLevel is set to All.

Help to diagnose this is highly appreciated. 

 

Morten

by (2.7k points)
Have you set the Protocol property to SFTP?
by (190 points)
No. I will try that.
by (190 points)
Same happens, but after setting the Protocol property, the ServerPort used was without setting the ServerPort property explicitly.
by (190 points)
What is strange, though, is that if I run the tool from another location on my PC, i.e. not from within Visual Studio, communication works just fine.
by (190 points)
Another observation: I have set break when a System.IO.IOException is thrown, and this is signalled three times when continuing on the same Connect() statement before reaching the catch clause. All exceptions are reported from within edtftpnetpro.dll.
by (162k points)
Try posting a relevant log file *snippet* when using the SFTP as the protocol.
by (190 points)
I think my implementation must have introduced something causing the exception. I use edtFTPnet from a slightly different program, and there SFTP connection works smoothly. I have to try to track down the exact cause before there is any use in a log file snippet, I think.
by (190 points)
If I run the executable outside VisualStudio, it works fine, but if I run it from within VS, I get the IOException.
Strange...

Please log in or register to answer this question.

...