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
    {
    Q_OBJECT
    ...
    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("192.168.1.160"),10199);
    Q_ASSERT(b);
    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);

        connect(m_socket,SIGNAL(readyRead()),this,SLOT(processDatagrams()));
        connect(m_timer,SIGNAL(timeout()),this,SLOT(heartTic()));
    
        heartTic();
        m_timer->setSingleShot(false);
        m_timer->start(secHeartTic*1000);
    

    }

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



  • I reinstall window xp,and it works!


Log in to reply
 

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