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. ReadyRead signal of QUdpSocket never emit on windows
Qt 6.11 is out! See what's new in the release blog

ReadyRead signal of QUdpSocket never emit on windows

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 2.9k Views 1 Watching
  • 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.
  • ? Offline
    ? Offline
    A Former User
    wrote on last edited by
    #1

    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
    }
    @

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      I reinstall window xp,and it works!

      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