Multicast with QUdpSocket and QHostAddress::Any does not work



  • For some reason I just recently ran into an issue with this.

    I configure the bind the following way:
    m_udpSocket.bind(QHostAddress::Any, 2222);

    then eventually when I want to respond to a message I call:
    qint64 dataWritten = poUdpSocketIo->writeDatagram(Data, qhaIPv4Addr, 2222);

    a qDebug() message is printed that showns:
    SUCCESS on writeDatagram() | dataWritten: 128 | Data.size(): 128

    However, when I use Wireshark I can see that this message never goes out on the wire.

    If I change the bind call to the following:
    m_udpSocket.bind(QHostAddress("192.168.100.3"), 2222);

    This multicast works perfectly fine and I can see packets being sent to multicast address 239.192.1.65.

    I have another computer setup with Windows 7 just like this failing one and I can see that even with QHostAddress::Any this still works.

    What could be wrong? Why is the multicast not working when the bind() call is passed QHostAddress::Any when it used to work and it works this way on another computer?


  • Lifetime Qt Champion

    Hi,

    On what OS/Qt combo do you have the failure ?



  • @SGaist I am running on Windows 7 Professional Service Pack 1 (64-bit Operating System). Also tried with both Qt 5.4.1 32-bit and Qt 5.3.1 32-bit.


  • Lifetime Qt Champion

    And it's falling only on that one computer ?



  • @SGaist Yes, it used to work on that computer previously.

    The only difference I have noticed so far it he following output using command prompt:

    FAILING COMPUTER

    C:\>netsh interface ip show join "Local Area Connection"
    
    Interface 11: Local Area Connection
    
    
    Multicast Address : 224.0.0.1
    Scope             : 0
    References        : 0
    Last Reporter?    : Yes
    
    Multicast Address : 224.0.0.252
    Scope             : 0
    References        : 1
    Last Reporter?    : Yes
    
    Multicast Address : 239.255.255.250
    Scope             : 0
    References        : 2
    Last Reporter?    : Yes
    
    
    C:\>
    

    WORKING COMPUTER

    C:\>netsh interface ip show join "Local Area Connection"
    
    Interface 13: Local Area Connection
    
    
    Multicast Address : 224.0.0.1
    Scope             : 0
    References        : 0
    Last Reporter?    : Yes
    
    
    C:\>
    

    I'm not sure if it is because the failing computer is showing two more Multicast Addressed. In which case I don't know how to remove the other two addresses.


  • Lifetime Qt Champion

    Got several network cards ?



  • @SGaist No just one.


  • Lifetime Qt Champion

    Did you check with the latest Qt 5.5 if you still experience this behavior ?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.