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

Different implementation variants of QLocalSocket

    XMLWordPrintable

Details

    • Suggestion
    • Resolution: Out of scope
    • P4: Low
    • None
    • 4.6.3, 4.7.0, 4.7.1, 4.8.0, 4.8.x, 5.0.0, Some future release
    • None

    Description

      Please improve documentation about QLocalSocket
      Under Windows it is NamedPipe with type PIPE_TYPE_MESSAGE. So applications may rely to winapi call CallNamedPipe(..).
      Under Linux it is UNIX STREAM socket.
      Under some other OS it is TCP socket, which is STREAM too.

      The developers should decide which mode should be used for QLocalSocket.
      It seems, that type should be defined in constructor. Under type I mean
      (PIPE_TYPE_MESSAGE or PIPE_TYPE_BYTE for Windows) and (SOCK_STREAM or SOCK_DGRAM on Unix).

      On OS where reliable dgram operations does not supported, operations should be emulated over stream connection.
      I think about UDP on local host, but it is unreliable.

      Now, the problem:
      UNIX version always use SOCK_STREAM, but windows version use PIPE_TYPE_MESSAGE. I think this is wrong.

      Also, as Windows implementation is message-oriented, I suppose problems in such pseudiocode:

      QLocalSocket client;
      client.write("abc");
      client.write("def");
      ....
      QLocalSocket server;
      server.read(); // may not read "abcdef". just "abc"
      

      And code, relying on transactional integrity (in Windows, as it uses message-oriented connection) may fail in Unixes, as the partial message can be read.

      Attachments

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

        Activity

          People

            docteam Qt Documentation Team
            socketpair@gmail.com Коренберг Марк
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes