Results 1 to 2 of 2

Thread: No working readyRead() signal in QUdpSocket

  1. #1
    Join Date
    Jan 2021
    Posts
    1
    Qt products
    Qt5
    Platforms
    Windows

    Default No working readyRead() signal in QUdpSocket

    Hi,

    I want to use QUdpScoket Multicast ,but readyRead() signal don't emit.
    Confirming that datagrams can be received at WireShark and SocketDebbugger.
    Firewall is Invalidation. Bind, connect, joinMulticast is true. I never get socket errorString.
    But readyRead() is don't emit. Why ?

    Qt Code:
    1. void Udp::fnUdpSetting(QString localIP,quint16 multicastPort,QString multicastIP)
    2. {
    3. m_pUdpSockRecv = new QUdpSocket(this);
    4.  
    5.  
    6. connect(m_pUdpSockRecv, SIGNAL( readyRead() ), this, SLOT( fnUdpRecvData() ));
    7.  
    8. if( m_pUdpSockRecv->bind( QHostAddress( localIP ) , multicastPort, QUdpSocket::DefaultForPlatform) ){
    9. if( m_pUdpSockRecv->joinMulticastGroup( QHostAddress( multicastIP ) )) {
    10. qDebug() << "Connection Success";
    11. } else {
    12. qDebug() << "Join Error";
    13. }
    14. }
    15. else {
    16. qDebug() << "Bind Error";
    17. }
    18.  
    19. }
    To copy to clipboard, switch view to plain text mode 


    The IP and Port I'm using are
    localIP: 192.168.0.122
    multicastPort: 49871
    multicastIP 239.0.0.15


    I don't get any errors or anything, so I have no idea.
    Can someone help me?
    Thanks.

  2. #2
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: No working readyRead() signal in QUdpSocket

    I'd try to connect to stateChanged and errorOccurred signals of the socket.
    Other than that it's hard to say without seeing the rest of the code, maybe you accidentally destroy the socket object somewhere ? first of all, is the event loop running ?

Similar Threads

  1. QSerialPort's readyRead() signal is working strange
    By Alexander111122 in forum Qt Programming
    Replies: 2
    Last Post: 25th November 2020, 12:53
  2. QUdpSocket readyRead failure
    By mike66 in forum Qt Programming
    Replies: 5
    Last Post: 27th November 2015, 00:00
  3. Replies: 10
    Last Post: 3rd January 2015, 13:25
  4. QUdpSocket readyRead() signal not triggered
    By deionut in forum Newbie
    Replies: 2
    Last Post: 26th October 2010, 19:19
  5. Not getting readyRead from a QUdpSocket
    By evelBist in forum Newbie
    Replies: 3
    Last Post: 20th July 2010, 20:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.