PDA

View Full Version : FTP: "Connection reset by peer"


Met44
February 6th, 2008, 03:04 PM
Hi folks, I wonder if you can help me with an issue I've been having with FTP.

I'm running Windows XP Home SP 2; the remote user (my girlfriend) is running XP Pro SP 2. My FTP Server is Gene6 FTP v3.10 (latest release). The client she is using is FileZilla, again latest release. She is attempting to download a file from me.

At first, we tried Window's CLI ftp utility. However, each of the two nights of attempting to transfer the same file, the transfer stopped. My logs showed that she got disconnected at 2h:00m, within about a second of each other both times, around the same byte number. The log file error was:

426 Retrieve aborted; Error 10054 in function ReadBuffer: Connection reset by peer

With FileZilla, the same error. I can't find any relevent information on it - anyone here familiar with this kind of problem?

Tonight, I'm going to try increasing the read buffer size and see if that has any effect.

Thanks,

Met

Snurfen
February 6th, 2008, 11:10 PM
Have you succesfully FTP'd along this path before?

Met44
February 7th, 2008, 02:19 PM
Thanks for the reply Snurfen,

The issue turned out to be TCP's default session timeout. TCP will automatically send keep-alive information over idle connections after apparently 2 hours, like the FTP control port (21) as data is being transferred on port 20 or a high order port. TCP will close its own connection if it receives no response. And according to the FTP standard, if TCP's control port gets shut down, the data port must shut down as well. FTP's RFC (RFC 793) doesn't actually give times, but from this experience it seems pretty likely that it's 2 hours.

In this case, it seems like either the Win XP Pro FileZilla client wasn't sending (or responding to) keep alives, or my Win XP Home Gene6 FTP demo version wasn't =p

So, I have two fixes but only tried one.

I created the following registry key on both systems, which by default does not exist in XP Home or Pro:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Servic es\Tcpip\Parameters\KeepAliveTime

and create a string KeepAliveTime. I set both the default value and the string KeepAliveTime value to 720000000, or some other high number, which is the number of milliseconds I wanted TCP to keep idle connections open for. This equates to 2000 hours, which is overkill, but I just figured out what 2 hours was in milliseconds and added some zeros (you could also call it vengeance). You might not need to change it on both, but I wanted to be done with this.

I made the tweak on both systems, and we let it go overnight again - it transferred just fine in 6 hours.

The other idea was to hunt around for FTP clients that send simple, periodic commands (like pwd) through the control port to keep the TCP session alive long enough for larger file downloads.

Hope someone at least gets a trivia question out of this!

Met

Snurfen
February 7th, 2008, 04:48 PM
Nice one Met, and many thanks for posting the resolution - very informative (now if we can just get people to search the threads a bit more often...... :p )