I am seeing that some ftp clients cannot complete when transferring thousands of files to an FTP server. The mput *
command runs for several hours and then hangs
in
150 Opening BINARY mode data connection.
I do not have an easy way to contact the FTP server administrators (all I have is an IP address in the block managed by WeHostWebSites.Com
and I know that this IP is shared by a dozen of domain names).
The FTP server introduces itself as
220 Microsoft FTP Service
So I assume it is IIS.
I am running an mput *
on a directory that contains thousands of files. Until the transfer hangs for a while, until the control connection is closed for inactivity.
Having examined the logs I see the following pattern. Initially the files are transferred in passive mode.
229 Entering Extended Passive Mode (|||53567|)
150 Opening BINARY mode data connection.
Then the port numbers increase until they reach 65200. At this point the server returns 501
.
229 Entering Extended Passive Mode (|||65201|)
501 Server cannot accept argument.
Which triggers the clients such as lukemftp
(that comes by default with OpenSUSE 11 installations) or FAR manager FTP plugin (which is popular with Windows users) to switch to active so the following transfers start with the PORT
command.
200 PORT command successful.
150 Opening BINARY mode data connection.
netstat -t
also shows that new connections go to port 20/tcp of the server. After transferring another 3000+ files the command hangs. At this point the output from netstat -t
shows how TIME_WAIT
connections drain and then the control connection is closed for inactivity.
Workaround: It is often suggested to use lftp
for large FTP transfers and this proved to be a way round the problem. Watching lftp
executing a mirror -R
command on a directory with 100000+ files I can see how the dynamic port numbers run up to 65200 and then continue from 49152 keeping all transfers in passive. So this command completes successfully.
Is there a way to work around this problem without the use of lftp
(In particular, what could be done on a purely Windows client that does not have lftp
?
Notice: This question was posted several months ago on http://serverfault.com but did not receive any answers and a recent close vote. I decided to remove it from ServerFault and repost it on SuperUser instead.