First post with WordPress 3.0 – fingers crossed but so far it looks good!
I’ve learned a small detail today – QFtp requires login even if you do not have any username or password to give the server. Saves some time from debugging time knowing that calling login once fixes this. (Yes, me stupid)
For those of you learning Qt or wanting to get started with Qt, I will hold a session on the Kubuntu Tutorial Day. I hope to see you there!
Also, great rainy weekend. Got loads of stuff done ranging from catching up on some work to restructuring parts of the garage.
First, you shouldn’t use QFtp. Second, you should use QNetworkAccessManager.
You should avoid using QFtp, and instead use QNetworkAccessManager. QFtp, QHttp and friends should not be used in new code.
As I understand it, QHttp is depricated and replaced by QNetworkAccessManager, but QFtp is still valid. From what I can tell from the documentation, QNetworkAccessManager is aware of FTP, but does not provide easy interaction.
The docs for QFtp say: ‘This class provides a direct interface to FTP that allows you to have more control over the requests. However, for new applications, it is recommended to use QNetworkAccessManager and QNetworkReply, as those classes possess a simpler, yet more powerful API.’. Are there any particular things you want from QFtp that you can’t do with QNAM?
Well, for once, I’d like to do a simple m_ftp->login(), to login :-)
From what I can tell of the QNAM docs, there is no explicit support for FTP, so I have to manufacture all my requests by hand. I’d prefer if the way the classes where introduced in Qt, was that QFtp utilized the QNAM class for its networking needs. Perhaps adding support for more protocols.
FTP is in contrast to HTTP stateful and session based. Therefore a login is mandatory according to the protocol definition (see also RFC 959).
In case no explicit login (historically unix accounts, today most often seperate credentials) is required you should use ftp/ftp or anonymous/email@address)
Last but not least you should try to avoid FTP by any means if feasible. This venerable 25 year old protocol does not fit into modern infrastructures anymore.
FTP may be old and not entirely up to date, but still, there are loads of applications where it is still used and useful. I’m not sure about the alternatives, but WebDAV has not reached a high enough adoptation degree yet, and HTTP is not really meant to be used to manage files…