Our Products:   CompleteFTP  edtFTPnet/Free  edtFTPnet/PRO  edtFTPj/Free  edtFTPj/PRO

Programmatically determine why SecureFTPConnection.Connect() has failed with ControlChannelIOException

0 votes
37 views
asked Apr 8 in .NET FTP by StlDeveloper (120 points)
I have a .NET application that uses edtFTPnet/PRO to round-robin check a number of different FTP servers, search for files, and if any are found meeting certain criteria, download the files to a local folder.

The app is controlled by information that is entered into a database table by a human.

The human sometimes enters information incorrectly, such as perhaps misspelling a hostname.  When this happens, the SecureFTPConnection's Connect() method fails and raises a ControlChannelIOException with the message "An I/O exception occurred.".

Is there any way to programmatically determine more precisely what the issue is, such as DNS name resolution error?

Thanks!

1 Answer

0 votes
answered Apr 10 by Admin (2,230 points)

There are a few different scenarios:

Exception Cause
FormatException The user supplies something that looks like an IP address, but which is invalid (e.g. 299.0.0.0).
ArgumentOutOfRangeException Hostname is longer than 255 characters.
SocketException Error while connecting to DNS server or to target server
ArgumentException Hostname could not be resolved
ControlChannelIOException Error while communicating with server (after connection)
SSHAuthenticationException SFTP/SCP authentication failed
FTPAuthenticationException FTP/FTPS authentication failed

 

...