I'm trying to write a simple code so that I can get files from a FTP server. My code is shown below, but I even cannot connect to that server (the code shown below has no errors). I've searched a lot and tried others codes, with no success. Is there any problem with my code? Any help will be appreciated.
#include "mainwindow.h"
#include <QApplication>
#include <QUrl>
#include <QNetworkAccessManager>
#include <iostream>
#include <QNetworkRequest>
using namespace std;
int main(int argc, char* argv[])
{
QApplication a(argc, argv);
QNetworkAccessManager qnam;
QUrl url("ftp://radaqco.com/somefile.txt");
url.setHost(QString("host"));
url.setUserName(QString("user"));
url.setPassword(QString("pswd"));
url.setPort(21);
QNetworkRequest nRequest(url);
qnam.get(nRequest);
return a.exec();
}