Navigation

    Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Search
    • Unsolved
    1. Home
    2. Tags
    3. qnetworkaccessm
    Log in to post

    • SOLVED QNetworkAccessManager keeps downloading wrong file...
      General and Desktop • qnetworkaccessm qnetworkaccess • • Dariusz  

      12
      0
      Votes
      12
      Posts
      342
      Views

      @Dariusz I still don't get how come you said the same URL worked to access the correct content from a web browser but not from QNetworkRequest, which was the important thing....
    • SOLVED How do I make a network request in Qt binding to a specific interface/IP?
      General and Desktop • qnetworkaccessm qnetworkrequest http post qnam • • Abbas Percin  

      7
      0
      Votes
      7
      Posts
      313
      Views

      Forgive me for bumping an old thread, but I too am interested in an answer to this question. As things stand I'm going to commit to using out-of-date APIs in order to accomplish this. But it'd be nice if there were an officially supported and modern way to make socket connections and HTTP / HTTPS requests using a specific network interface.
    • SOLVED Correct code to prevent memory leak with QNAM HTTP Get request to nonexistent URL with Qt 5.14.2
      General and Desktop • qnetworkaccessm qt5.14.2 timeout http get qnam • • WilliamJ  

      5
      0
      Votes
      5
      Posts
      220
      Views

      Thank you Christian! https://bugreports.qt.io/browse/QTBUG-88063 describes exactly what I've been seeing.
    • UNSOLVED Login and save session to navigate to other pages
      General and Desktop • qnetworkaccessm qnetworkreply qnetworkrequest qnetworkcookiej qurlquery • • najihahnizar  

      1
      0
      Votes
      1
      Posts
      121
      Views

      No one has replied

    • SOLVED How to initialize a QNetworkAccessManager properly
      General and Desktop • qnetworkaccessm • • Aymeric_Qt  

      3
      0
      Votes
      3
      Posts
      271
      Views

      Hello SGaist, Thank you very much for your answer. I was sure I've already tried to make it a member variable of the class and having some error. Not a the compilation but when I tried to launch the app (app was ended forcefully as the messages read). I had to make a mistake at the time but I can remmber I've done differently. Anyway now it's working, thank you!
    • UNSOLVED Compare QUrl or slot for each response?
      Qt WebKit • qnetworkaccessm c++11 signals & slots qurl restful api • • Rizwan94  

      4
      0
      Votes
      4
      Posts
      379
      Views

      @Rizwan94 I never used QNAM, so do not know whether better to use that one or QNetworkReply Yes
    • UNSOLVED For Rest API calls, use QNAM or restsdk
      Qt WebKit • qnetworkaccessm c++11 restful api restsdk • • Rizwan94  

      2
      0
      Votes
      2
      Posts
      339
      Views

      Hi, You have to do some testing to see which one works best for you. Since you are using Qt, QNAM asynchronous nature follows Qt design and what you are used to.
    • SOLVED When qnetworkreply is delete after request from QNetworkAccessManager::get(QNetworkRequest request (url))?
      General and Desktop • qnetworkaccessm qnetworkreply qnetworkrequest qnetwork • • Yash001  

      2
      0
      Votes
      2
      Posts
      163
      Views

      Hi, Usually you don't store the reply but rather connect its signals to lambdas, do the processing there and then call deleteLater on it once you are done.
    • UNSOLVED QSocketNotifier Exception After Deletion of QNetworkAccessManager Object
      General and Desktop • qnetworkaccessm qnetworkreply qnetworkrequest qsocketnotifier • • Zach M  

      10
      0
      Votes
      10
      Posts
      710
      Views

      Ahh sorry I thought an strace would help. It might take me a bit to get an actual stack trace as I'd have to set up my build environment with debugging symbols. The reason I was recreating QNetworkAccessManager is because I was under the impression that I needed to do so when I lost network access (m_mgr->networkAccessible() != QNetworkAccessManager::Accessible). That's what a user said on this stack overflow post. Is that incorrect? If I could just used something like setNetworkAccessible() that would avoid this whole mess. I've tested out removing the QNAM deletion and the exception does not occur. I guess I am sort of confused in general about what QNetworkAccessManager::NetworkAccessibility even represents? It's not going to alter the actual network state, NetworkManager handles that
    • SOLVED uploadProgress signal emitted 0/0 with long delay
      General and Desktop • qnetworkaccessm qnetworkreply qnetworkrequest upload • • yasen  

      7
      0
      Votes
      7
      Posts
      714
      Views

      Tested on another server, everything works fine
    • SOLVED QNetworkAccessManager seems to leak with every retry
      General and Desktop • qnetworkaccessm memory networking • • Smaankers  

      10
      0
      Votes
      10
      Posts
      1470
      Views

      Okay I found the culprit in an unexpected corner. I decided to completely strip it to the absolute bare minimum: int main(int argc, char *argv[]) { QCoreApplication app (argc, argv); // initialization Sms_notifier notifier(true, 5); notifier.notify( "+0123456789", "Lorem Ipsum is simply dummy text of the printing and typesetting industry. "); qWarning() << "done, looping"; while(true) { QCoreApplication::exec(); } } Sms_notifier::Sms_notifier(bool test, int interval_length_milliseconds) : QObject (NULL) ,m_test (test) ,m_interval_length_milliseconds(interval_length_milliseconds) ,m_manager () ,m_timer () ,m_addressee() ,m_payload() { m_timer.setSingleShot(true); QObject::connect(&m_manager, &QNetworkAccessManager::finished, this, &Sms_notifier::on_nam_finished); QObject::connect(&m_timer, &QTimer::timeout, this, &Sms_notifier::on_timer_elapsed); } Sms_notifier::~Sms_notifier() { } bool Sms_notifier::notify( const std::string addressee, const std::string payload ) { m_addressee = addressee; m_payload = payload; return notify(); } bool Sms_notifier::notify() { QNetworkRequest request; QByteArray data; m_manager.post(request, data); return false; } void Sms_notifier::on_nam_finished(QNetworkReply* reply) { QNetworkReply::NetworkError error = reply->error(); reply->deleteLater(); if (error != QNetworkReply::NetworkError::NoError) { m_timer.start(m_interval_length_milliseconds); } else { qWarning() << "success"; m_addressee.clear(); m_payload.clear(); } } void Sms_notifier::on_timer_elapsed() { notify(); } It turns out it was still leaking while there was no network. So I stripped away all libraries that were linked, and it still leaked. Eventually my eye struck this in the .pro file: QMAKE_CXXFLAGS += -fsanitize=address QMAKE_CFLAGS += -fsanitize=address QMAKE_LFLAGS += -fsanitize=address -lasan This was added to detect memory leaks and report them when the application quits. After removing this, the excessive "memory leak" was gone. I am assuming that the address sanitizer allocates memory for each allocation done by the application, for its own administration purposes. I suspect that when the application releases the allocated memory, the sanitizer holds on to the respective administration data until the application quits. This could explain why when I remove the sanitizer it also removes the leak. Well, thanks everyone for your input!
    • UNSOLVED How to properly handle asynchronous events with Qt test framework? QSignalSpy::wait() returns false even though signal emitted during given time interval
      General and Desktop • qnetworkaccessm qnetworkreply qtest qtestlib qsignalspy • • Red Baron  

      3
      0
      Votes
      3
      Posts
      2478
      Views

      Thanks for the reply. Will check it out.
    • UNSOLVED QNetworkAccessManager and Python http server
      General and Desktop • python qnetworkaccessm • • umod.47  

      3
      1
      Votes
      3
      Posts
      1425
      Views

      There's nothing wrong with GET request, since it has no payload, just a header. Problems begin with POST. Server side is pretty simple, with one exception: it sends HTTP reply header ASAP and THEN launches CGI script. Here is a Wireshark dump of an interconnection with python server: http://umod47.ru/qtfail.pcapng
    • UNSOLVED QNetworkAccessManager purges cookies if following redirect
      General and Desktop • qnetworkaccessm qtnetwork redirect cookies • • Jiloc  

      8
      0
      Votes
      8
      Posts
      2946
      Views

      @raven-worx I did as you suggested https://bugreports.qt.io/browse/QTBUG-63313 . Hope the bug report is properly documented
    • MDTM:Command not understood
      General and Desktop • qnetworkaccessm ftp • • Rohith  

      3
      0
      Votes
      3
      Posts
      1046
      Views

      @jsulm said in MDTM:Command not understood: ftp://115.111.229.10/21.05.2016.xls Thanks for replying, yes the url is working fine with wget wget ftp://username:password@(IP)/21.05.2016.xls
    • UNSOLVED How to send QString to server in Qt 5.6?
      QtWebEngine • network qnetworkaccessm qnetworkreply qnetworkrequest • • d1.psy  

      7
      0
      Votes
      7
      Posts
      2289
      Views

      @d1.psy so you want the cookies from the requests you already made with QtWebEngine? If so take a look at QWebEngineCookieStore (see it's signals) and "sync" the cookies into your QNAM.
    • UNSOLVED Android QNetworkAccessManager in background
      Mobile and Embedded • android qnetworkaccessm • • dead_man  

      2
      0
      Votes
      2
      Posts
      729
      Views

      I resolved my problem by moving request object to main thread
    • SOLVED can't get JSON file from QNetworkReply
      General and Desktop • json qnetworkaccessm qwebengineview qnetworkrequest qnetreply • • nazimGT  

      2
      0
      Votes
      2
      Posts
      4561
      Views

      resolved !! i've chenged m_pNetworkAccessManager->get(request); by request.setRawHeader("Content-Type", "application/x-www-form-urlencoded"); QByteArray par=""; m_pNetworkAccessManager->post(request,par);
    • UNSOLVED How to find complete information about the file to be downloaded using QNetworkAccessManager HTTP Qt
      General and Desktop • network qnetworkaccessm file http download • • Farhan  

      2
      0
      Votes
      2
      Posts
      1437
      Views

      The server is not returning anything useful in the HTTP headers (I wouldn't expect it to): ~/tmp$ wget -S 'http://u801.wapkafile.com//g03/video/1253022/7940/c8f9a32ef15648bfa6f693102de27835/DARNA-ZAROORI-HAI-3(Movies7.In).avi?md5=TU7ibYa85byjzJyJcH_LXQ&expires=1458916610' --2016-07-27 18:21:15-- http://u801.wapkafile.com//g03/video/1253022/7940/c8f9a32ef15648bfa6f693102de27835/DARNA-ZAROORI-HAI-3(Movies7.In).avi?md5=TU7ibYa85byjzJyJcH_LXQ&expires=1458916610 Resolving u801.wapkafile.com (u801.wapkafile.com)... 8.37.229.38 Connecting to u801.wapkafile.com (u801.wapkafile.com)|8.37.229.38|:80... connected. HTTP request sent, awaiting response... HTTP/1.1 200 OK Server: nginx Date: Wed, 27 Jul 2016 08:21:15 GMT Content-Type: video/x-msvideo Content-Length: 65707724 Connection: keep-alive Last-Modified: Wed, 31 Dec 2014 06:15:08 GMT Content-Disposition: attachment; filename="DARNA-ZAROORI-HAI-3(Movies7.In).avi" Accept-Ranges: bytes Expires: Wed, 03 Aug 2016 06:34:10 GMT Cache-Control: max-age=604800 Cache-Control: s-maxage=604800,max-age=604800 Age: 6425 X-Cache: HIT TCP_MEM_HIT dirn:0:1402323922 X-Swift-SaveTime: Wed, 27 Jul 2016 06:34:10 GMT X-Swift-CacheTime: 604800 Via: 440d210b[0,206-0,H] Length: 65707724 (63M) [video/x-msvideo] Saving to: 'DARNA-ZAROORI-HAI-3(Movies7.In).avi?md5=TU7ibYa85byjzJyJcH_LXQ&expires=1458916610.1’ So Download Manager must be getting the info from the metadata at the start of the file. For example, I only downloaded the first 70KB of the file, and: ~/tmp$ file DARNA-ZAROORI-HAI-3\(Movies7.In\).avi\?md5=TU7ibYa85byjzJyJcH_LXQ\&expires=1458916610 DARNA-ZAROORI-HAI-3(Movies7.In).avi?md5=TU7ibYa85byjzJyJcH_LXQ&expires=1458916610: RIFF (little-endian) data, AVI, 640 x 360, ~30 fps, video: H.264 X.264 or H.264, audio: MPEG-1 Layer 3 (stereo, 22050 Hz) So the info is there at the start. I expect you'll want to use a library to parse it out. I'm not sure if Qt has such functionality built-in. Perhaps have a look through the Qt Multimedia docs. Cheers.
    • UNSOLVED QNetworkAccessManager FTP request without HELP
      General and Desktop • qnetworkaccessm ftp • • Rinin  

      2
      0
      Votes
      2
      Posts
      847
      Views

      Hi and welcome to devnet, Did you try to access the server ? What did you try ?
    • UNSOLVED Memory leak in QNetworkProxy (should i post on bugtracker?)
      General and Desktop • qnetworkaccessm memory leak qnetworkreply qnetworkrequest qnetworkpoxy • • Vlad_Savelyev  

      3
      0
      Votes
      3
      Posts
      1166
      Views

      sure i will reply with the project code
    • UNSOLVED Set custom socket on QNetworkAccessManager request
      General and Desktop • qtcpsocket qnetworkaccessm qnetwork socks4 winsock • • eventhorizon99  

      2
      0
      Votes
      2
      Posts
      1299
      Views

      Hi and welcome to devnet, Maybe QNetworkProxy might something. Hope it helps
    • SOLVED QNetworkReply, HTTP file download, and error headers on failure
      General and Desktop • qnetworkaccessm qnetworkreply • • Catherine Olsen  

      3
      0
      Votes
      3
      Posts
      837
      Views

      @Catherine-Olsen Maybe you could post your solution here so if others are facing similar problems they can find a way to go? ;)
    • SOLVED how to get Transfer rate when downloading file
      General and Desktop • qnetworkaccessm qnetworkreply transfer rate • • ARASHz4  

      4
      0
      Votes
      4
      Posts
      1014
      Views

      @the_ I can't even math anymore. thanks for the correction
    • UNSOLVED HTTP response time with QNetworkAccessManager is more when compared to Dlib and Libcurl
      General and Desktop • qnetworkaccessm qnetworkreply qnetworkrequest qurl • • ksranjith786  

      10
      0
      Votes
      10
      Posts
      3824
      Views

      @ksranjith786 said: Could you please provide guidelines or code snippet to use QNetworkAccessManager using multi threaded env. No, I can't, sorry. Not that I don't want to, but I don't know of any way you can control the number of threads QNetworkAccessManager uses internally (I think it's hardcoded). If I were to do multithreading with NAM I'd do it like you - thread the reply's processing. Unfortunately this bears no weight on the HTTP response time. On a related note, I would always prefer to use TCP/IP directly, as it provides much more fine-grained control of what's happening (including threading). The downside of that approach however, is that it'd require implementing the HTTP protocol by hand. Perhaps, as @p3c0 suggested, you could try to ask the question on the mailing list were you might get responses from the actual developers of the module. Kind regards.
    • UNSOLVED QNetworkAccessManager with PHP and MYSQL
      Mobile and Embedded • mysql qnetworkaccessm php • • werter  

      12
      0
      Votes
      12
      Posts
      10329
      Views

      Thank you. I take a look on it.
    • SOLVED QNetworkAccessManager is not sending data part of POST request
      General and Desktop • qnetworkaccessm http-post • • CupaMurdosan  

      4
      0
      Votes
      4
      Posts
      2855
      Views

      Thank you guys for your replies. Problem is solved - I was wrong with wireshark - data were sent in another packet [TCP segment of a reassembled PDU].
    • http post data encoding
      General and Desktop • qnetworkaccessm qurl post • • 4j1th  

      4
      0
      Votes
      4
      Posts
      3511
      Views

      @4j1th said: Hi @Paul-Colby , by using the first method how can I access the file (in server), is it works as a file uploading method ? It depends on your server. What language is your server written with? (Assuming you're POSTing to your own server, and not some third-party API). For example, the server was running PHP, you could do something like: $data = json_decode(file_get_contents('php://input'), true); // save $data to a file somewhere. In that case, you wouldn't need to use WWW form encoding.
    • QNetworkAccessManager - first GET very slow
      General and Desktop • network qnetworkaccessm qnetworkrequest http get • • Aerius  

      15
      0
      Votes
      15
      Posts
      8734
      Views

      @djee In My Way connectToHost To Http Server Not Working, So I Call QSslConfiguration::defaultConfiguration(); Instead.
    • SOLVED How to load a .p12 key into the QSslKey object?
      Qt WebKit • qnetworkaccessm qsslconfigurati qsslkey • • GoneWithTheFood  

      3
      0
      Votes
      3
      Posts
      2669
      Views

      @luca yes you are right. :) Just now I've tried to export the private key from the .p12 file with the openssl API. This key could be constructed into QSslKey object now. Thanks a lot. But to configure in such a way is a little bit too complicated. Is there any class or method I can use, so that I can directly import the .p12 file into the QSslConfiguration object?
    • Put request in Qt using QNetworkAccessManager
      Mobile and Embedded • qnetworkaccessm put • • nimadid  

      6
      0
      Votes
      6
      Posts
      5360
      Views

      You should also connect the error signal to see if you it tells you something useful.
    • QNetworkAccessManager finished signal error
      General and Desktop • qnetworkaccessm signals emit • • 4j1th  

      16
      0
      Votes
      16
      Posts
      6697
      Views

      Since it's a QObject you can use the parent/child paradigm to let Qt handle the deletion for you.
    • UNSOLVED QNetworkAccessManager and POST return
      General and Desktop • qnetworkaccessm post return • • Helson  

      12
      0
      Votes
      12
      Posts
      16790
      Views

      You are welcome! Have a nice day :)
    • SOLVED QNetworkAccessManager Download Image
      General and Desktop • qpixmap qnetworkaccessm • • elveatles  

      5
      0
      Votes
      5
      Posts
      2090
      Views

      Printing out thumbnailData.data(), I get: 302 Found The resource was found at https://... So I realize my problem now. The thumbnail url is redirecting me to another url which is what I actually want to use to download for the QPixmap. Thanks for your help everyone.
    • QtWebEngine porting : custom file storage or html archive file
      General and Desktop • qtwebengine qnetworkaccessm qtwebkit qrc zip • • QbProg  

      1
      0
      Votes
      1
      Posts
      825
      Views

      No one has replied

    • QNetworkAccessManager throw "QWaitCondition" warning.
      General and Desktop • qnetworkaccessm • • kartlee144  

      2
      0
      Votes
      2
      Posts
      1348
      Views

      I found this link discussing about the trace seen in Windows https://bugreports.qt.io/browse/QTBUG-7691 Not sure if this is still related to mine.
    • downloadProgress bytesTotal -1
      General and Desktop • qnetworkaccessm qnetworkreply • • Franckynos  

      5
      0
      Votes
      5
      Posts
      1772
      Views

      @Franckynos said: But there isn't way to have a real progression ? It depends on whether or not the server sends correct Content-Length field in the header. It's not like Qt can magically guess the value if the server didn't send it. It's a bullshit to remove QFtp class. Huh. What does that out of context comment have to do with the issue? I can't have size of file with some request ? See above.
    • Getting two QNetworkReply after request
      General and Desktop • qnetworkaccessm qnetworkreply • • David.G  

      1
      0
      Votes
      1
      Posts
      601
      Views

      No one has replied

    • [SOLVED]Exe file crashes
      General and Desktop • qtcpsocket qnetworkaccessm • • andrewkiko  

      4
      0
      Votes
      4
      Posts
      2817
      Views

      You're welcome ! Since you have it running now, please update the thread title prepending [solved] so other forum users may know a solution has been found :) Also, consider up-voting answer(s) that helped you, it will make them easier to find for other users :)