Results 1 to 3 of 3

Thread: help with readyRead() signal "mechanics"

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Munich, Germany
    Posts
    4,714
    Thanks
    21
    Thanked 418 Times in 411 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default help with readyRead() signal "mechanics"

    Hi,

    In the new "C++ programming with Qt4" book, in page 331, there is an example of a server-client application, and in the method that does the actual data reading from the server there is the following code:
    Qt Code:
    1. //'in' is a QDataStream bound to the socket
    2. if(batesAvailable() < sizeof(quint16) ) //the first fielld in the block should be sizeof quint16
    3. return;
    4. in>> nextBlockSize; //read the first field which holds the next block size;
    5. if(bytesAvailable() < nextBlockSize)
    6. return;
    7.  
    8. //code for reading the whole block.
    To copy to clipboard, switch view to plain text mode 
    What I understand from this code is, that the readyRead() signal is emmited each time a new byte is added to the send buffer on the server side, other wise the code above would not work (and I am assuming it does).
    The text in the book doesn't relate at all to this point, so I was wondering if some of you with some experience with socket programming with Qt4 could confirm my assumption.
    The reason I have trouble accepting this, is that it means that QTcpSocket class will emit as many signals as bytes that the server will send, and seems to me that its a lot of overhead....
    On the other hand it could be I am missing here something, and hope you can point me to what it might be

    Thanks.
    Last edited by high_flyer; 13th August 2006 at 16:00.

Similar Threads

  1. Replies: 2
    Last Post: 17th May 2006, 21:01
  2. no such signal QListBox::currentChanged()
    By jopie bakker in forum Newbie
    Replies: 2
    Last Post: 2nd March 2006, 15:17
  3. send signal from QCombobox
    By raphaelf in forum Qt Programming
    Replies: 22
    Last Post: 28th February 2006, 14:18
  4. signal slot conection using a string, not a SLOT
    By rianquinn in forum Qt Programming
    Replies: 6
    Last Post: 5th February 2006, 18:52
  5. No such signal...
    By chaimar in forum Qt Programming
    Replies: 12
    Last Post: 24th January 2006, 22:33

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.