My company has a series of VoIP devices that we setup via FTP. We get the files from the boxes, modify them, and send them back. The files are not very large in size (1-2 KB). I have a VB.NET application to do this. A simplified version of my GET function is as follows:
Public Function GetAllFilesFromBox(ByVal IPAddr as string) as boolean
Dim i As Integer
Dim FileName As String
Dim ftp As FTPClient
Try
ftp = New FTPClient
ftp.RemoteHost = IPAddr
ftp.Timeout = FTPTimeout
ftp.ConnectMode = FTPConnectMode.ACTIVE
ftp.Connect()
ftp.Login(UserName, Passwd)
ftp.ChDir(BoxFileDir)
For i = 0 to 20
FileName = FileLocation & FileNames(i)
ftp.Get(FileName, FileNames(i))
Next
Return True
Catch
ErrorLog.WriteException(ex)
Return False
Finally
if (ftp.Connected) then
ftp.Quit
end if
End Try
End Function
I call this function asynchronouslly multiple times so that I can retreive files from more than one box at a time. I typically do 20 boxes at a time as my default. Note that each call to the function creates its own instance of the FTPClient. Once I reach my limit, I will start another box as one finishes. However, on Windows XP SP2, this often fails. I typically do not get all of the files from all of my boxes. Some finish completely, but on some I will get some of the files and then the function will fail with an exception "
Unable to read data from the transport connection."
I have discovered the following. This only happens on XP SP2 with the firewall turned on. If I turn it off, I get all the files from all the boxes. If I switch to passive mode, it works fine, but other issues may prevent us from using passive mode. If I do each box one at a time, it works fine, but of course this takes forever. Even just 2 at a time will cause some failures. XP SP2 has a limit on the number of outbound connection attempts as detailed here:
http://www.speedguide.net/read_articles.php?id=1497
I tried the fix, but it didn't help. Any ideas as to what is going on? I just downloaded the new 1.2.3 version of edtFTPnet yesterday and nothing in there seemed to fix the problem, but this is the version that I am currently using.