Results 1 to 4 of 4

Thread: Network Programming Error/Line Edit

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #3
    Join Date
    Mar 2009
    Location
    Brisbane, Australia
    Posts
    7,729
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows
    Thanks
    13
    Thanked 1,610 Times in 1,537 Posts
    Wiki edits
    17

    Default Re: Network Programming Error/Line Edit

    You are assuming that readyRead() will be called once for each complete 'line' from the sender. This will rarely be the case. You cannot assume the first character in a read is the first character of a line, that the last character is the end of a line, or that you have only parts of a single line.

    You must buffer what is received until you can find a complete line in the data and then process it. You must leave any unprocessed data in the buffer.

    It it also not clear that you are sending a line ending, e.g. CR and/or LF, that the receiver will be looking for when reading a line.
    Last edited by ChrisW67; 11th November 2013 at 21:15.

Similar Threads

  1. QTableView line edit clears the text on edit
    By PlasticJesus in forum Qt Programming
    Replies: 5
    Last Post: 14th March 2015, 20:06
  2. Network Raw Programming
    By havij000 in forum Qt Programming
    Replies: 6
    Last Post: 28th August 2013, 12:49
  3. Replies: 3
    Last Post: 26th August 2010, 09:57
  4. qt4 network programming
    By linuxqt in forum General Programming
    Replies: 3
    Last Post: 12th March 2009, 16:41
  5. Replies: 8
    Last Post: 15th May 2007, 10:21

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
  •  
Qt is a trademark of The Qt Company.