Cannot connect to any ftp server (wodSFTP / wodSFTP.NET / wodSFTPdll)
I recently upgraded the wodFTPDLX component to the 1.6.3 version to have .NET 2010 compatibility. However, I cannot get it to successfully connect to any ftp server since the upgrade. I receive the following exception when attempting to connect to the server from my application:
No such host is known
System.Net.Sockets.SocketException (0x80004005): No such host is known
at System.Net.Dns.GetAddrInfo(String name)
at System.Net.Dns.InternalGetHostByName(String hostName, Boolean includeIPv6)
at System.Net.Dns.GetHostEntry(String hostNameOrAddress)
I am able to connect to the specified ftp server manually. I have my code posted below. Any help will be appreciated.
public static void UploadFile(string filePath, string userName, string password, string hostName, string remotePath, string protocolType)
{
FtpDLX ftp = new FtpDLX();
ftp.Hostname = hostName;
ftp.Login = userName;
ftp.Password = password;
ftp.Blocking = true;
ftp.Timeout = 100;
switch (protocolType)
{
case s :
ftp.Protocol = Protocols.SFTP;
break;
default:
ftp.Protocol = Protocols.FTP;
break;
}
try
{
try
{
ftp.Connect();
}
catch (Exception ex)
{
Console.WriteLine(ex.Message +
+ ex.ToString());
}
if (ftp.State == States.Connected)
{
ftp.PutFile(filePath, remotePath);
}
if (ftp.LastError != null)
{
Console.WriteLine( Error with ftp: + ftp.LastError);
}
}
catch (Exception ex)
{
Console.WriteLine(ex.Message +
+ ex.ToString());
}
finally
{
if (ftp != null)
{
ftp.Disconnect();
ftp.Dispose();
}
}
}