Results 1 to 3 of 3

Thread: empty reply of a POST request

  1. #1
    Join Date
    Jan 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Arrow empty reply of a POST request

    I have a piece of code that makes a POST request to a server and gets the reply. If I put this code into a class instantiated in my main application it works fine.
    Qt Code:
    1. int main(int argc, char *argv[])
    2. {
    3. QApplication app(argc, argv);
    4. MyClass*camera = new MyClass();
    5. //In MyClass constructor is made the POST request and displayed the result
    6. return app.exec();
    7. };
    To copy to clipboard, switch view to plain text mode 

    If I put it into a shared library and use this library in my application, I receive always an empty reply. I know is not really very specific, but since the code works from the main application, I do not think is a problem with the code.
    In my library I have a class like this:
    Qt Code:
    1. class LINUXSDKSHARED_EXPORT LinuxSDK: public QObject
    2. {
    3. Q_OBJECT
    4. ...
    5. public:
    6. LinuxSDK(QObject *parent = 0);
    7. ~LinuxSDK();
    8. ...
    9. public slots:
    10. void onfinish(QNetworkReply *rep);
    To copy to clipboard, switch view to plain text mode 
    The SLOT is working, it is called. I tried with a QEventLoop to wait for a reply but it looks like waits forever. I work in Ubuntu. The status code of the reply is 0, meaning the connection was accepted and then closed gracefully (TCP FIN). Why was it closed?
    Can you help me with some useful ideas?
    Thanks
    Last edited by WhiteR; 16th January 2016 at 00:01.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: empty reply of a POST request

    And your main() is the same? Just the class defined in a library?

    Cheers,
    _

  3. #3
    Join Date
    Jan 2016
    Posts
    2
    Qt products
    Qt5
    Platforms
    Unix/X11 Windows

    Lightbulb Re: empty reply of a POST request

    I think I solved it. I have derived MyClass from QMainWindow instead of QObject. It seams it works now
    Last edited by WhiteR; 16th January 2016 at 21:04.

Similar Threads

  1. POST request - getting cookie
    By Trok in forum Qt Programming
    Replies: 3
    Last Post: 17th September 2012, 00:32
  2. Replies: 0
    Last Post: 7th August 2012, 20:36
  3. Replies: 5
    Last Post: 15th December 2011, 01:06
  4. Request ID of QNetworkaccessmanager get and post request
    By dineshkumar in forum Qt Programming
    Replies: 2
    Last Post: 4th February 2011, 22:56
  5. Https POST Request
    By munna in forum Qt Programming
    Replies: 10
    Last Post: 11th November 2006, 15:24

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.