Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Multiple udp sockets bound to the same ip address
Forum Updated to NodeBB v4.3 + New Features

Multiple udp sockets bound to the same ip address

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 1.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    xBlue
    wrote on last edited by
    #1

    Hi,
    i am having some trouble when binding two udp sockets on the same ip address, even thought i am using the ShareAddress flag. Since i did not find my mistake, i created a simple test program only including the Qt multicast receiver example code. But when i run the example programm twice, the second one also fails to bind to the socket with the error message "The bound address is already in use". Since the first one binds without any problems, there can not be any other applications which are already blocking the address. So my question is: is this intended and i am just misunderstanding the ShareAddress flag? If so, is there another way to use SO_REUSEADDR via Qt?
    I am using a windows 8.1 machine and qt 5.11.1.
    Thanks for the help and sorry for my english :)

    JonBJ 1 Reply Last reply
    0
    • X xBlue

      Hi,
      i am having some trouble when binding two udp sockets on the same ip address, even thought i am using the ShareAddress flag. Since i did not find my mistake, i created a simple test program only including the Qt multicast receiver example code. But when i run the example programm twice, the second one also fails to bind to the socket with the error message "The bound address is already in use". Since the first one binds without any problems, there can not be any other applications which are already blocking the address. So my question is: is this intended and i am just misunderstanding the ShareAddress flag? If so, is there another way to use SO_REUSEADDR via Qt?
      I am using a windows 8.1 machine and qt 5.11.1.
      Thanks for the help and sorry for my english :)

      JonBJ Online
      JonBJ Online
      JonB
      wrote on last edited by
      #2

      @xBlue
      https://stackoverflow.com/a/25720057/489865 reminds you that the docs state ShareAddress has no effect under Windows. You need to use QUdpSocket::ReuseAddressHint instead.

      X 1 Reply Last reply
      2
      • JonBJ JonB

        @xBlue
        https://stackoverflow.com/a/25720057/489865 reminds you that the docs state ShareAddress has no effect under Windows. You need to use QUdpSocket::ReuseAddressHint instead.

        X Offline
        X Offline
        xBlue
        wrote on last edited by
        #3

        @JonB
        Ah ok, i already saw that post. But since the Qt documentation on the QAbstractSocket::DefaultForPlatform flag says: "[...], and on Windows, its equivalent to ShareAddress." i assumed that ShareAddress has no effect under windows because it is the default setting. Thanks for your answer :)

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved