Read website data from a custom port? (not 80 http)

  • hey, i'm building a launcher software that syncs some stuff according to a custom port from a specific website, but i'm unable to read this data as long as the port isn't 80:
    QNetworkAccessManager* nam;

    nam = new QNetworkAccessManager(this);
          connect(nam, SIGNAL(finished(QNetworkReply*)),this, SLOT(replyFinished(QNetworkReply*)));

    works, but if i input a working alternative port-url like

    i will not get any data from that capture, like it wasn't even connected (i bet it wasn't) while that url does give me data trough a regular browser like firefox or chrome.

    notice: input does work as the regular http port, the issue is in any other port.

    is there something i'm doing wrong? im not that familar with network programming yet as i mainly focused on offline.
    thanks in advance!

  • Hi,

    have you tried to catch Network errors?

    QUrl myUrl("http://somesite:7201");
    QNetworkReply *reply = nam->get(QNetworkRequest(myUrl));
    connect(reply, SIGNAL(error(QNetworkReply::NetworkError code)), this, SLOT(handleError(QNetworkReply::NetworkError code)));

  • @mcosta thanks for your reply

    i tried to catch the error now and got code 2, which means:

    "the remote server closed the connection prematurely, before the entire reply was received and processed"

    still can't figure why is it happening..

  • Hi,

    something also to understand server-side

  • @mcosta

    i am able to view the page inside the browser tho, why can't Qt read it then?

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.