Suggested bugfix in FTP.OpenDataSocket() method

Nov 30, 2012 at 10:07 AM
Edited Nov 30, 2012 at 10:20 AM

I'm not a 100% sure this is a bug. I've noticed when the GetFile is used, that it takes relatively much time before the actual transfer starts. I found out it's because of this line in the FTP.OpenDataSocket() method:

IPEndPoint endpoint = new IPEndPoint(Dns.Resolve(ipAddress).AddressList[0], port);

The Dns.Resolve which isn't needed in my opinion (because an ipadress is used, never a host name here) takes a lot of time

I replaced it with this code which runs much faster:

 IPEndPoint endpoint = new IPEndPoint(IPAddress.Parse(ipAddress), port);

Dec 1, 2012 at 5:43 PM

Thanks for the report.  I've fixed the source tree and checked it in.