I have to connect to a number of hosts without knowing if they can accept the Passive mode.
In you code I had to modify FTPControlSocket (line 316) to trap an error and change the Mode from Passive to Active.
// PASV
try
{
return CreateDataSocketPASV();
}
catch (Exception E)
{
connectMode = FTPConnectMode.ACTIVE;
return CreateDataSocketActive();
}
If I use FTP command I can get file information without delay does not matter if it's Passive or Active Host.
Your code creates quite a delay on Connect() and next when on socket.Connect(remoteEP).
Any chance you can "speed up" you code?