tags:

views:

87

answers:

2

Hi Guys,

I have an FTP monitoring/downloading application using C# sockets. I got this error message:

421 Disconnecting you since you were inactive for 300 seconds.

Can someone have an explanation for this? I did a search on this one but still I can't seem to find a good explanation. Thanks.

+3  A: 

It says it disconnected you because your connection was inactive for 300 seconds. This is a common practice on FTP servers since (as opposed to HTTP) FTP is not stateless, connections stay open and connections that do nothing can easily fill the connection limit of the server.

The obvious solution is making sure you don't stay inactive for 300 seconds. Create a timer that does something every minute or so, like getting a list of files in the current directory or something.

EDIT: As ChaosPandion mentionned in a comment, maybe you should just close the connection when you're done and reopen it when you need it again.

DrJokepu
Really if your app is not performing any tasks for 300 seconds (*A lifetime in code.*) you should probably disconnect.
ChaosPandion
@ChaosPandion: agreed.
DrJokepu
+1  A: 

I think this pretty much explains itself. The server is disconnecting your connection, since it wasn't active for 5 minutes. The questions is: what counts as activity? I'm afraid the answer won't be found in the FTP RFC, since this can be implementation-specific. Also, the timeout interval may vary (it may be configurable via the FTP administration utility).

If I'm correct, you'll simply have to design your application to work around this constraint, by reconnecting when disconnected, and performing any activities necessary to re-validate your application's inner state.

M.A. Hanin