Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Is it possible to open several FTP connections, at the same time, with different FTP servers?
-
I want to upload some local files, through FTP, to several different FTP Servers.
To avoid to perform successive "connect/login/upload files/close", is it possible to open several connections to different FTP servers at the same moment, or the common port number (21) does allow that?
So I could do "connect-1/connect-2/login-1/login-2/upload 1st file-1/upload 1st file-2/......../close-1/close-2" -
You might try a google search on "Python async ftp". In general, Python supports threads, multiprocessing, and in Python 3 asyncio. Apple's iOS restrictions prevent multiprocessing from working in Pythonista. If you are ok to use Python 3 only then you might look into using stash to bring in https://pypi.python.org/pypi/aioftp which uses asyncio. Otherwise, look at the threading examples in the search above. Each session will need its own port -- I.e. Not everyone on port 21.
-
Thanks for your answer but both FTP servers oblige port 21 😢
That's not vital, I'll upload all files to one server at a time. -
You could still get some parallelism by having port 1030 on your Pythonista box talking with port 21 on server_a while on a different thread, port 1031 on your Pythonista box was talking with port 21 on server_b.
-
Thanks for your perseverance in trying to help me...
But I'll use the easiest solution by uploading all my files to only one FTP server at a time.