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

QLocalServer doesn't trigger AddressInUseError with setSocketOptions

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.5.0, 5.15.0, 6.2.3
    • Network: Sockets
    • None
    • Archlinux

    Description

      I'm afraid I only have a PyQt example ready for this:

      With this code:

      from PyQt5.QtCore import QCoreApplication
      from PyQt5.QtNetwork import QLocalServer
      
      app = QCoreApplication([])
      
      QLocalServer.removeServer('/tmp/ipc-test')
      
      s1 = QLocalServer()
      ok = s1.listen('/tmp/ipc-test')
      print('s1: {}'.format(ok))
      print(s1.errorString())
      
      s2 = QLocalServer()
      s2.setSocketOptions(QLocalServer.UserAccessOption)
      ok = s2.listen('/tmp/ipc-test')
      print('s2: {}'.format(ok))
      print(s2.errorString())
      print(s2.serverError())
      

      I don't get an AdressInUseError like I'd expect:

      s1: True
      s2: True
      -1
      

      When commenting the setSocketOptions line, it works as expected:

      s1: True
      s2: False
      QLocalServer::listen: Address in use
      8
      

      Attachments

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

        Activity

          People

            richmoore Richard Moore (qtnetwork)
            the compiler Florian Bruhin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes