Navigation

    Qt Forum

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

    • SOLVED QtNetwork: incomingConnection not triggered
      General and Desktop • socket qtnetwork • • calmstack  

      9
      0
      Votes
      9
      Posts
      86
      Views

      Hi, @calmstack said in QtNetwork: incomingConnection not triggered: @jsulm Isn't it what the official documentation recommends ? No, it's one usage example. You have the same example without threads.
    • UNSOLVED Petite problématique avec QtNetwork
      French • qtnetwork problem ftp ftp repository • • Vincent66  

      5
      0
      Votes
      5
      Posts
      278
      Views

      @Vincent66 Bonjour, QTfp ne fait plus parti du project Qt mais les sources restes accessibles sur GitHub ==> https://github.com/qt/qtftp Pourquoi ne pas simplement partir de là et faire les adaptations eventuellement nécessaire pour la compilation?
    • SOLVED Error : "Protocol \"https\" is unknown"
      General and Desktop • network openssl ssl qtnetwork error qt • • Qjay  

      9
      0
      Votes
      9
      Posts
      887
      Views

      hey i didn't fixed it . i downloaded Qt5.12.4 and then upgraded my openssl lib to 1.1.1b so i am good now thanks !!
    • SOLVED Qt Https request with openssl - No response
      General and Desktop • openssl qtnetwork https post • • Thanni  

      3
      0
      Votes
      3
      Posts
      533
      Views

      It wooooorked, thank you so muuuuch :)
    • UNSOLVED HTTPS POST performance
      General and Desktop • performance qtnetwork https post https post • • wrekler  

      5
      0
      Votes
      5
      Posts
      670
      Views

      @SGaist said in HTTPS POST performance: Hi and welcome to devnet, @wrekler said in HTTPS POST performance: How relevant is knowing the server? It is relevant because: It might be sleeping if for example it's an heroku free tier that hasn't been used for some times. Therefore the first query will have to wait for the server to awaken thus it will be longer. It might require authentication which takes some time on first query to setup and allow to process. It might need to query some slow to start resource to answer your question etc. Oh, I see. Well it is not a my server, it is a thirdy party server, so I can't answer to all that question. All I know is: It is hosted on akamai.com Acqtually it require some authentication data that I give with POST data So I think I can't optimize requests server side, all can I do is caching DNS/TCP/SSL requests but I don't know if Qt 5.11.2 actually implements all that suggestions
    • SOLVED Failed to build Qt5.8 with openssl1.0.2p linked[MSVC2015]
      General and Desktop • openssl msvc2015 qtnetwork nmake • • IMAN4K  

      6
      0
      Votes
      6
      Posts
      1023
      Views

      @SGaist NO, both are 32bit. Seems clearing the build dir and make again solved the problem!
    • SOLVED Why QNetworkReply run-time crash on deleteLater() ?
      General and Desktop • crash qnetworkreply qtnetwork deletelater • • IMAN4K  

      10
      0
      Votes
      10
      Posts
      1946
      Views

      At long last! i decided to simply process reply in worker thread(Thanks @raven-worx ): using Header = QMap<QString, QString>; class HttpWorker : public QObject { Q_OBJECT public: struct HttpData { bool hasError = false; NetworkError error = NetworkError::NoError; QString errorString; QByteArray data; }; HttpWorker(QThread*, const QUrl&, const QUrlQuery&); ~HttpWorker(); void addHeaders(const Header&); enum Method { Post, Get }; void setMethod(Method m) { http_method = m; } Method method() const { return http_method; } private Q_SLOTS: void sendRequest(); private: QNetworkAccessManager manager; Header headers; QUrlQuery params; QUrl url; Method http_method = Post; private: void check(QNetworkReply*); void appendHeaders(QNetworkRequest*); Q_SIGNALS: void finished(HttpData); }; HttpWorker::HttpWorker(QThread* thread, const QUrl& _url, const QUrlQuery& _params) :url{ _url }, params{ _params } { qRegisterMetaType<HttpData>("HttpData"); moveToThread(thread); manager.moveToThread(thread); QObject::connect(thread, &QThread::started, this, &HttpWorker::sendRequest); QObject::connect(this, &HttpWorker::finished, thread, &QThread::quit); QObject::connect(thread, &QThread::finished, thread, &QThread::deleteLater); QObject::connect(thread, &QThread::finished, this, &HttpWorker::deleteLater); QObject::connect(&manager, &QNetworkAccessManager::finished, this, &HttpWorker::check); } HttpWorker::~HttpWorker() { } void HttpWorker::addHeaders(const Header& _headers) { headers = std::move(_headers); } void HttpWorker::appendHeaders(QNetworkRequest* req) { if (!req) return; QMapIterator<QString, QString> iterator(headers); while (iterator.hasNext()) { iterator.next(); req->setRawHeader(QByteArray::fromStdString(iterator.key().toStdString()), QByteArray::fromStdString(iterator.value().toStdString())); } } void HttpWorker::sendRequest() { const auto content_h = QStringLiteral("application/x-www-form-urlencoded"); if (method() == Post) { QNetworkRequest req(url); req.setHeader(QNetworkRequest::ContentTypeHeader, content_h); if (!headers.isEmpty()) appendHeaders(&req); const auto data = params.isEmpty() ? url.toEncoded() : params.toString(QUrl::FullyEncoded).toUtf8(); manager.post(req, data); } else { url.setQuery(params); QNetworkRequest req(url); req.setHeader(QNetworkRequest::ContentTypeHeader, content_h); manager.get(req); } } void HttpWorker::check(QNetworkReply* reply) { HttpData data; if (reply->error()) { data.hasError = true; data.error = reply->error(); data.errorString = reply->errorString(); } else { data.data = std::move(reply->readAll()); } emit finished(std::move(data)); reply->deleteLater(); }
    • SOLVED Some trouble with QNetworkAccessManager and wifi on Windows 7
      General and Desktop • windows 7 qt5.9 qtnetwork • • nelbok  

      8
      0
      Votes
      8
      Posts
      1820
      Views

      Ok, it sounds like a bug then. Good if you open ticket. Make sure to include a small complete working example they can use to reproduce it.
    • UNSOLVED QNetworkAccessManager purges cookies if following redirect
      General and Desktop • qnetworkaccessm qtnetwork redirect cookies • • Jiloc  

      8
      0
      Votes
      8
      Posts
      2393
      Views

      @raven-worx I did as you suggested https://bugreports.qt.io/browse/QTBUG-63313 . Hope the bug report is properly documented
    • UNSOLVED Suggestion to using QNetworkReply in a webAPI
      General and Desktop • qnetworkreply qtnetwork api • • IMAN4K  

      9
      0
      Votes
      9
      Posts
      1613
      Views

      @IMAN4K You could just emit a signal after getting the data and processing it.
    • UNSOLVED QNetwork error when use Qt lib with native JNI Android application
      Mobile and Embedded • android qtnetwork ndk jni x86 • • alexpi  

      1
      0
      Votes
      1
      Posts
      520
      Views

      No one has replied

    • SOLVED Question regarding Big/Little endian
      General and Desktop • linux windows qtnetwork • • DRoscoe  

      4
      0
      Votes
      4
      Posts
      1611
      Views

      By default QDataStream uses big endian. You can change it manually, but do so on all platforms you want to deploy to/programs you're deploying. In any case you're fine as long as you stream your data with the appropriate operators and don't use writeRawData/readRawData or any reinterpret_cast "tricks".
    • SOLVED Running Qt Example client/server not working
      General and Desktop • network qtnetwork server client • • marlenet15  

      17
      0
      Votes
      17
      Posts
      5225
      Views

      @marlenet15 Hi, Here you can find a threaded TCP server example. You can ignore the module specific classes QDaemonApplication (think of it as QCoreApplication) and QDaemonLog you can substitute with QDebug. Enjoy! Kind regards.
    • UNSOLVED 2-way network communication between 2 Qt programs
      General and Desktop • c++ qtnetwork networking tcpsocket tcpserver • • htmlboss  

      2
      0
      Votes
      2
      Posts
      774
      Views

      @htmlboss Hi, let's call them "node" and "controller" Let's not do that. Let's call them a server and a client - it's much better and easier to follow the accepted terminology. A server will serve the requests presented by the clients (see the analogy with a busy restaurant?). There can only be one "controller", but the number of "nodes" may vary (eg. different clients). So you have one server and a few clients. So far so good. I want to have the "controller" initiate the connection to each client such that arbitrary data is sent back and forth as it is ready (readyRead() signal? ). How data flows between the client and the server is completely independent of who initiated the connection. You can still have the server sending data to the clients (what http servers mostly do), and still the client initiates the connection (i.e. your browser). I have implemented the Fortune Client/Server example with the "controller" as the Client (since it would initially ask for a connection), and the Fortune Server as a test (eventually it would be a "node" sending data). This is where I'm stuck. Ignoring less-than-critical performance issues, how would I modify the Fortune example (or perhaps roll my own) to allow the Server to accept data from the "controller" without the use of any buttons/etc, but to get it as it is "ready"? Ideally, this needs to scale up to a max of 15 "nodes". Just write from the appropriate side (application). The server should stay the server, and the client should stay a client, don't switch their roles. Kind regards.
    • UNSOLVED QSsl Configuration in VS2013 strange error
      General and Desktop • openssl qtnetwork vs 2013 qsslconfigurati • • Ni.Sumi  

      9
      1
      Votes
      9
      Posts
      2835
      Views

      @Ni.Sumi I mean the compiler invocation, not the error (I saw the error in your first post). It should look something like this: g++ -c -pipe -g -std=gnu++0x -Wall -W -D_REENTRANT -fPIC -DQT_QML_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I../../myproject -I. -I../../../qt/qt-5.6/qtbase/include -I../../../qt/qt-5.6/qtbase/include/QtWidgets -I../../../qt/qt-5.6/qtbase/include/QtGui -I../../../qt/qt-5.6/qtbase/include/QtCore -I. -I../../../qt/qt-5.6/qtbase/mkspecs/linux-g++ -o somesource.o ../../myproject/somesource.cpp / I've taken it from g++, but you get the idea - the compile line, the call that compiles the offending source. / Kind regards.
    • SOLVED java.lang.UnsatisfiedLinkError: dlopen failed: could not load library "libQt5Qml.so"
      Mobile and Embedded • android qtnetwork ndk qtqml • • Sanders  

      2
      0
      Votes
      2
      Posts
      3569
      Views

      @Sanders I finally resolved my issue. The problem was due to the Qt libraries. Indeed I was using the 5.6 version and to fix it I downgraded to the 5.5 version
    • SOLVED QtNetwork: Why don't I detect incomming connections ? (incomingConnection() is never fired)
      General and Desktop • qthread qtcpserver qtnetwork • • QtExchange  

      4
      0
      Votes
      4
      Posts
      1619
      Views

      It is working now and the reason was the listen() was in the wrong position and you need an additional Signal/Slot connection from main program to the network extension as following: the main program gets changed like this: wifi= new WirelessNet(0); QThread *thread = new QThread; wifi->moveToThread(thread); connect(thread,SIGNAL(started()), wifi,SLOT(initWifi())); thread->start(); the constructor of WirelessNet is now empty, therefore it gets a new public slot function: void WirelessNet::initWifi() { listen(QHostAddress::Any, 5220); } And that's the trick. If one is creating a WirelessNet-Instance, starts listenting inside the constructor but first then uses the movetoThread(), the connection is lost. Concluding in one sentence: First move to the right thread and afterwards start listening Thanks for your help. Let me tell you I hate the official Qt-""Tutorials""
    • Strange behaviour of Signal/Slots (QtNetwork) used over QThread
      General and Desktop • qthread signal & slot qtnetwork qeventloop • • QtExchange  

      8
      0
      Votes
      8
      Posts
      2594
      Views

      @QtExchange Forgot to link those two, which are very important to understand before working with threads: QObjects' thread affinity: http://doc.qt.io/qt-5/qobject.html#thread-affinity Queued connections accros threads: http://doc.qt.io/qt-5/threads-qobject.html#signals-and-slots-across-threads
    • SOLVED Run multiple QEventLoops in parallel (for QtNetwork)
      General and Desktop • qtnetwork qeventloop parallel • • QtExchange  

      6
      0
      Votes
      6
      Posts
      1782
      Views

      I never tried to start a thread with event loop in a program without main event loop (QApplication). My guess: it will work inside your thread, but you will not be able to communicate with the thread from main thread using signals/slots.
    • SOLVED qt.network.ssl: QSSlSocket: cannot resolve
      General and Desktop • openssl qtnetwork • • Frederick0  

      7
      0
      Votes
      7
      Posts
      9245
      Views

      @mrjj no misunderstanding. It was the latter and both of your responses were equally helpful.
    • UNSOLVED Why am I getting many “RemoteHostClosedError” sending a POST over HTTP?
      General and Desktop • qt5.5 qnetworkreply qtnetwork http • • alex.santana  

      2
      0
      Votes
      2
      Posts
      1766
      Views

      Hi, Why are you creating your request on the heap rather than stack ? Also, you never delete the request so you might be covering one with another and you have a memory leak.
    • UNSOLVED QUdpSocket::hasPendingDatagrams() broken in Qt 5.5 on Windows Desktop
      General and Desktop • qt5.5 qtnetwork qudpsocket windows desktop • • bsomervi  

      3
      0
      Votes
      3
      Posts
      2488
      Views

      Raised issue https://bugreports.qt.io/browse/QTBUG-49301