Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-81066

[Windows] QLocalServer receives incorrect data when server and clients send data simultaneously

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 5.12.3
    • Network
    • None
    • Windows

      I'm using QLocalServer to make IPC between my apps. From client/server logic there is a valid message for both of them. In case of an incorrect message received - assertation happens. 

      For example (attached below), on every connection made, the server sends "server" string to the clients. When a client connects to the server - it sends "client" string. So, the server expects only "client" to be received and vice versa: 

      void Server::onReadRead() {
      // for example
      QString message;
      socketDataStream.setDevice(qobject_cast<QLocalSocket*>(sender())
      socketDataStream >> message;
      Q_ASSERT(message == "client");
      }
      

      In the attached example, the message sent after the socket connection.

      On Windows, this assertation triggered every time when the client connects. On Unix, no triggers, as for QTcpSocket will be used instead.

      Is this a bug form a named pine perspective or there is no possibility to read/write simultaneously when pipe used?

      The code from Qt should make this possible.

      Please check the attached example, run the server first.

       

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            manordheim Mårten Nordheim
            pavloshyba Pavlo Shyba
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes