开发者

FTP monitoring and downloading of new files

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开发者_如何学JAVA.

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.


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜