Skip to content Skip to sidebar Skip to footer

How Can I Specify The Client's Data Port For A Ftp Server In Active Mode?

I use python ftplib to connect to a ftp server which is running on active mode; That means the server will connect my client machine on a random port when data is sent between us.

Solution 1:

There is no way to do this with the standard ftplib module.

You're either going to have find an alternate library which offers this functionality or monkey-patch the makeport() method on your FTP object if you're feeling brave.

Solution 2:

Since Python 3.3, ftplib functions that establish connections take a source_addr argument that allows you to do exactly this.

Post a Comment for "How Can I Specify The Client's Data Port For A Ftp Server In Active Mode?"