Cannot connect to any ftp server - WeOnlyDo Discussion board

Cannot connect to any ftp server (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Planza, Thursday, November 04, 2010, 17:55 (4919 days ago)

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();
}
}
}

Re: Cannot connect to any ftp server

by woddrazen, Thursday, November 04, 2010, 18:02 (4919 days ago) @ Planza

Hi Planza,


What happens if you try to use wodFtpDLX.NET samples? Does it works there maybe?

You can find samples in component Samples folder.

Let us know how it goes.


Regards,
Drazen

Re: Cannot connect to any ftp server

by planza, Friday, November 05, 2010, 17:27 (4918 days ago) @ woddrazen

I have attempted to run the samples, but get an exception with the message of:

An instance of type 'WeOnlyDo.Client.FtpDLX' was being created, and a valid license could not be granted for the type 'WeOnlyDo.ClientFtpDLX'....

I have a valid license code. What should I do to fix this and proceed with troubleshooting my initial problem?

thx

Hi Planza,


What happens if you try to use wodFtpDLX.NET samples? Does it works there maybe?

You can find samples in component Samples folder.

Let us know how it goes.


Regards,
Drazen

Re: Cannot connect to any ftp server

by wodDamir, Friday, November 05, 2010, 17:39 (4918 days ago) @ planza

Hi,

Did you set LicenseKey property in the samples (by default it's not specified)?

Also, the error you submitted in first post means that the machine specified in Hostname property cannot be reached. Can you check that it's 100 correct hostname (chekc for spaces etc)?

Regards,
Damba

Re: Cannot connect to any ftp server

by planza, Friday, November 05, 2010, 17:48 (4918 days ago) @ wodDamir

Thanks for the quick response.

I will enter the license key and try again.

Regarding my initial problem, I am 100 certain that the host name is entered correctly. I have tried with multiple hostnames (all of which are functioning properly), but the ftp component never connects. I can connect if I copy and paste the hostname value into the url bar of internet explorer or an ftp client program though.

Any ideas?

Thanks,
P

Hi,

Did you set LicenseKey property in the samples (by default it's not specified)?

Also, the error you submitted in first post means that the machine specified in Hostname property cannot be reached. Can you check that it's 100 correct hostname (chekc for spaces etc)?

Regards,
Damba

Re: Cannot connect to any ftp server

by wodDamir, Friday, November 05, 2010, 17:52 (4918 days ago) @ planza

Hi,

I can't tell exactly without reproducing the issue. However, two most probable reasons would be:

- firewall preventing the component to connect or

- wrong hostname (containing space or similiar)

Regards,
Damba

Re: Cannot connect to any ftp server

by planza, Friday, November 05, 2010, 18:13 (4918 days ago) @ wodDamir

I figured it out. The issue was with my putting ftp://ftp.sitename.com instead of only ftp.sitename.com . The component was able to connect once I removed the protocol prefix from the hostname property and added the license key.

Thanks for the help.

P

Hi,

I can't tell exactly without reproducing the issue. However, two most probable reasons would be:

- firewall preventing the component to connect or

- wrong hostname (containing space or similiar)

Regards,
Damba