Results 1 to 4 of 4

Thread: How to read and write line by line?

  1. #1
    Join Date
    Feb 2008
    Location
    Russia, Moscow
    Posts
    35
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question How to read and write line by line?

    Hi!

    How I can read and write information to/from socket line by line?

    Now I'm doing this:
    Qt Code:
    1. tcpSocket.waitForReadyRead();
    2. QByteArray request( tcpSocket.readAll() );
    To copy to clipboard, switch view to plain text mode 

    But this is incorrect, because program don't wait two "\r\n" and after first write goes next.

    PS I'm writing a small HTTP server.

    And also one question: how I can get speed of file downloading? And how I can set it? Or how I can abor connection from UI?

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to read and write line by line?

    J-P Nurmi

  3. #3
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: How to read and write line by line?

    For downloading speed, see Implementing TCP Traffic Control.
    J-P Nurmi

  4. #4
    Join Date
    Nov 2010
    Posts
    47
    Thanks
    7
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: How to read and write line by line?

    This example does not work since Qt 4.2: http://www.qtcentre.org/threads/1020...314#post167314

    Have You tried it at least once? Does it work for You???

Similar Threads

  1. How can I Read Write Excel File
    By xingshaoyong in forum Qt Programming
    Replies: 6
    Last Post: 13th July 2011, 20:16
  2. QTcpSocket waiting for write to be read
    By spraff in forum Qt Programming
    Replies: 1
    Last Post: 23rd December 2008, 19:12
  3. [java] write and read from file a dictionary
    By mickey in forum General Programming
    Replies: 1
    Last Post: 15th December 2008, 17:54
  4. [Java] read and write a file
    By mickey in forum General Programming
    Replies: 3
    Last Post: 22nd June 2008, 10:43
  5. structures to a file (read and write)
    By baray98 in forum Qt Programming
    Replies: 5
    Last Post: 10th February 2008, 20:12

Tags for this Thread

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.