Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Read website data from a custom port? (not 80 http)
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved General and Desktop
httpportcustomwebsitedatagetread
5 Posts 2 Posters 3.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Arty.McLabin
    wrote on 30 May 2015, 17:33 last edited by
    #1

    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*)));
    
          nam->get(QNetworkRequest(QUrl("http://somesite.com/");
    

    works, but if i input a working alternative port-url like
    http://somesite.com:7201

    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: http://somesite.com:80 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!

    Static linking is cool. Really.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mcosta
      wrote on 30 May 2015, 19:54 last edited by
      #2

      Hi,

      have you tried to catch Network errors?
      Like

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

      Once your problem is solved don't forget to:

      • Mark the thread as SOLVED using the Topic Tool menu
      • Vote up the answer(s) that helped you to solve the issue

      You can embed images using (http://imgur.com/) or (http://postimage.org/)

      A 1 Reply Last reply 1 Jun 2015, 16:54
      1
      • M mcosta
        30 May 2015, 19:54

        Hi,

        have you tried to catch Network errors?
        Like

        QUrl myUrl("http://somesite:7201");
        
        QNetworkReply *reply = nam->get(QNetworkRequest(myUrl));
        connect(reply, SIGNAL(error(QNetworkReply::NetworkError code)), this, SLOT(handleError(QNetworkReply::NetworkError code)));
        
        A Offline
        A Offline
        Arty.McLabin
        wrote on 1 Jun 2015, 16:54 last edited by
        #3

        @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..

        Static linking is cool. Really.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on 1 Jun 2015, 19:00 last edited by
          #4

          Hi,

          something also to understand server-side

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          A 1 Reply Last reply 5 Jun 2015, 13:54
          0
          • M mcosta
            1 Jun 2015, 19:00

            Hi,

            something also to understand server-side

            A Offline
            A Offline
            Arty.McLabin
            wrote on 5 Jun 2015, 13:54 last edited by
            #5

            @mcosta

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

            Static linking is cool. Really.

            1 Reply Last reply
            0

            1/5

            30 May 2015, 17:33

            • Login

            • Login or register to search.
            1 out of 5
            • First post
              1/5
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved