FTP server at ftp.adrive.com resolves into multiple addresses:
c:\>nslookup ftp.adrive.com
Server: triton.hq.rebex.cz
Address: 192.168.2.3
Non-authoritative answer:
Name: ftp.adrive.com
Addresses: 65.49.56.55
65.49.56.53
65.49.56.57
65.49.56.56
65.49.56.54
65.49.56.52
65.49.56.58
Rebex FTP/SSL uses the first address in the list. The order of resolved addresses is different each time, but the result is cached, which means Rebex FTP/SSL actually uses the same address each time until the cached DNS record expires.
We will consider changing this behavior (which means Rebex FTP/SSL would behave like FileZilla). In the meantime, use the following Resolve
method as a workaround. Simply call serverName = Resolve(serverName)
before calling Ftp.Connect
method:
public static string Resolve(string serverName)
{
// resolve server name
IPHostEntry entry = Dns.GetHostEntry(serverName);
// get all IPv4 addresses
var addresses = new List<string>();
foreach (IPAddress address in entry.AddressList)
{
if (address.AddressFamily == AddressFamily.InterNetwork)
addresses.Add(address.ToString());
}
// if none found, get IPv6 addresses instead
if (addresses.Count == 0)
{
foreach (IPAddress address in entry.AddressList)
{
if (address.AddressFamily == AddressFamily.InterNetworkV6)
addresses.Add(address.ToString());
}
}
// pick one of the addresses randomly
if (addresses.Count > 0)
{
serverName = addresses[new Random().Next(0, addresses.Count - 1)];
}
return serverName;
}