Results 1 to 2 of 2

Thread: readyRead signal too slow or what?

  1. #1
    Join Date
    Feb 2006
    Posts
    209
    Thanks
    13
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default readyRead signal too slow or what?

    I have written a client/server program that communicates, and everything worked as planned, until I found that the server sent two messages very quickly, then the client didn't read both the messages, just the first.
    Can this really happen, that the readyRead() signal is emitted two times so fast that it doesn't have a chance to handle them both and just handle one of them?
    If so, how to fix it? (I added a second call to the networkreader at the end of the networ reader code if were any data left to read and that seems to work.)

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: readyRead signal too slow or what?

    TCP doesn't know anything about your messages as it passes a stream of data. QTcpSocket might receive more than one message at a time, but it will emit readyRead() only once.

    When you read data from the buffer, make sure you read everyting, not just the first message.

  3. The following user says thank you to jacek for this useful post:

    Morea (6th July 2007)

Similar Threads

  1. Replies: 2
    Last Post: 17th May 2006, 22:01

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.