Results 1 to 2 of 2

Thread: QTcpSocket reads partially string

  1. #1
    Join Date
    Jul 2012
    Posts
    17
    Thanks
    2
    Platforms
    Unix/X11 Windows

    Default QTcpSocket reads partially string

    Hello qtcentre community,

    with QTcpSocket I'm connecting to an irc server and i get a response, so far so good.

    Sometimes the reponse is cut off in the middle and the string looks like this:
    Qt Code:
    1. :asimov.freenode.net 372 Rosi :- By connecting to freenode you indicate that you have read
    2. :asimov.freenode.net 372 Rosi :- and agree to adhere to our po // this aint the end of the message!
    To copy to clipboard, switch view to plain text mode 
    And at the next call of readyRead() I receive the rest:
    Qt Code:
    1. licies and procedures as per
    2. :asimov.freenode.net 372 Rosi :- the website (http://freenode.net). We would like to remind
    To copy to clipboard, switch view to plain text mode 
    Is there a way to force the socket to read the whole message to the end?
    Or a way to concat these strings, that they make sense?

    Thank you.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTcpSocket reads partially string

    Quote Originally Posted by Edder View Post
    Is there a way to force the socket to read the whole message to the end?
    No, since there is no "end". Learn how TCP works.

    Or a way to concat these strings, that they make sense?
    Sure.

    Qt Code:
    1. QString sum = string1+string2;
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. Replies: 1
    Last Post: 15th September 2011, 21:25
  2. Replies: 1
    Last Post: 13th April 2011, 23:08
  3. QIODevice read() problem (reads more than maxSize)
    By m15ch4 in forum Qt Programming
    Replies: 0
    Last Post: 22nd February 2011, 11:09
  4. Replies: 3
    Last Post: 26th April 2010, 03:15
  5. Replies: 2
    Last Post: 19th December 2008, 15:57

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.