When can an FTP server close its passive connections?

Posted by Don Kirkby on Server Fault See other posts from Server Fault or by Don Kirkby
Published on 2010-10-26T20:15:42Z Indexed on 2010/12/25 23:55 UTC
Read the original article Hit count: 219

Filed under:
|

Does the FTP protocol allow the server to close any of its passive connections while the client is still connected? Can it tell when the client is finished receiving and then close the connection?

I'm including an FTP server in my application using the pyftpdlib Python project. I've got it to work in active and passive mode, but I'm a bit concerned about when it closes its passive connections. I've tried connecting to it with both FileZilla and the default ftp command in Ubuntu, and in both cases, I get a new passive port for every request. That is, if I sit in the root folder and type ls 10 times, I use up 10 ports. This means that I have to allocate a big block of passive ports for the FTP server to use so it won't run out.

As soon as the client disconnects, the server releases all the passive connections associated with that client and those ports can be reused. However, a long-running connection could use up a lot of ports.

© Server Fault or respective owner

Related posts about ftp

Related posts about python