List files on ftp server using QNetworkAccessManager
Hi,
I need to get a list of files from a ftp server and as Qt-Doc recommended wanted to use the QNetworkAccessManager for that. But I have no clue where to start. With QFtp everything is so easy :).
My code to connect isbasically this:
Code:
QNetworkAccessManager* qnam = new QNetworkAccessManager(this);
url.setPort(21);
QNetworkRequest nRequest(url);
this->qnam->get(nRequest);
But the ftp server log doesn't show any response to this. Which it did, when I tried QFtp.
Is there somewhere a nice tutorial for QNam or even good sample code for this?
Thanks for your help,
bbg
Re: List files on ftp server using QNetworkAccessManager
Your code is going to fail because you haven't provided a URL to access, e.g.:
Code:
QUrl url
("ftp://my.server.com/somefile.txt");
The QNetworkAccessManager support for FTP extends to get and put requests only, so you should use QFtp if you are doing more with your FTP server.
Re: List files on ftp server using QNetworkAccessManager
That answers my questions. Thanks :).