Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Qt Multicast and Broadcast



  • In my code,receive two kinds of data broadcast and multicast.If using multicast, broadcast data sent to bind port, multicast will receive.I don't know Why?I don't want to receive the broadcast data.

    Someone encountered this problem?
    @
    if (doMulticast){

         m_recvRawSock.bind(Port, QUdpSocket::ShareAddress);
         m_recvRawSock.joinMulticastGroup(QHostAddress(groupAddress));
         connect(&m_recvRawSock,SIGNAL(readyRead()),this,SLOT(process()));
    

    }
    else {

        m_recvRawSock.bind(QHostAddress::Any,Port);
        connect(&m_recvRawSock,SIGNAL(readyRead()),this,SLOT(process()));
    

    }@


Log in to reply