Important: Please read the Qt Code of Conduct -

ReadyRead signal of QUdpSocket never emit on windows

  • I had a sample project written by QT works fine on linux(debian),but got trouble when port it to windows.
    The problem is that readyRead signal of QUdpSocket never been emitted even it already recv data.i write a timer to check return value of hasPendingDatagrams(), when i send some data to this udp socket from other tools,this return value turn to be true,and pendingDatagramSize return right size of it. why readReady signal didn't emit?

    I notice another things,if the QUdpSocket had been got some data,"delete m_socket" will be blocked. what happened?

    there's code:

    header file
    class VoiceSession : public QObject
    private slots:
    void heartTic();
    void processDatagrams();

    cpp file
    VoiceSession::VoiceSession(const QString& addr,quint16 port,int secHeartTic,QObject* parent)
    : QObject(parent),m_socket(new QUdpSocket(this)),m_timer(new QTimer(this)),m_addr(addr),m_port(port) {
    createUid(); //DEMO
    bool b = m_socket->bind(10199);//QHostAddress(""),10199);
    logger()->debug("Startup... Server[%1:%2]",addr,(int)port);
    logger()->debug("Startup... Local[%1:%2] UID[%3]",m_socket->localAddress().toString(),m_socket->localPort(),(int)s_uid);



    void VoiceSession::processDatagrams() {
    ... // never run

  • I reinstall window xp,and it works!

Log in to reply