Results 1 to 3 of 3

Thread: QUdpSocket not getting responses

  1. #1
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Thanks
    65
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default QUdpSocket not getting responses

    I've had some success getting QUdp servers and clients to talk to each other.

    But for some reason, when I call this code:

    Qt Code:
    1. writeDatagram( buffer, host_address, port_number );
    2. this->waitForReadyRead( 5000 );
    3. while ( this->hasPendingDatagrams() == true ) {
    4. cout << "received a response!" << endl;
    5. }
    To copy to clipboard, switch view to plain text mode 

    The server sees the buffer (and netcat can see it also), but the client never sees the response.

    I have gotten a response before (when using a QUdpSocket server), but for some reason it doesn't seem to see the response when I use a scheme server.

    Using netcat and a small example, it looks like the scheme server is sending a response, but the QUdpSocket isn't detecting there is something to read.

    Any suggestions?

  2. #2
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Thanks
    65
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QUdpSocket not getting responses

    Even more confusing is I've got a slot connected to readyRead() that never gets called when I use the scheme server but does get called when I use the Qt server.

  3. #3
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Thanks
    65
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: QUdpSocket not getting responses

    I shouldn't have to call bind() on the temporary port that gets used for writeDatagram should I? I'm not using that with my Qt-based server and it works fine. I'm not sure how I would even get access to that port number.

    I've successfully used Scheme's udp-send-to command to send ASCII text to my Qt server, but when I have a Qt client it can send the ASCII text to my scheme server but when the scheme server returns it, the Qt client doesn't detect it.

    I'm continually checking pendingDatagramSize() and it's always -1.
    Last edited by mhoover; 8th July 2009 at 01:46.

Similar Threads

  1. QUdpSocket: sending and receiving on the same socket?
    By mhoover in forum Qt Programming
    Replies: 16
    Last Post: 17th June 2009, 03:28
  2. QUdpSocket -- Rebinding with Different Port Numbers
    By swamyonline in forum Qt Programming
    Replies: 0
    Last Post: 22nd January 2009, 13:39
  3. Strange problems with QUdpSocket
    By montylee in forum Qt Programming
    Replies: 2
    Last Post: 14th October 2008, 07:51
  4. QUdpSocket binding
    By db in forum Qt Programming
    Replies: 0
    Last Post: 13th March 2008, 11:24
  5. QUdpSocket and ShareAddress
    By mdecandia in forum Qt Programming
    Replies: 5
    Last Post: 26th March 2007, 17:06

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.