Results 1 to 3 of 3

Thread: reading Continously from QTextStream

  1. #1
    Join Date
    Nov 2007
    Posts
    291
    Thanks
    85
    Thanked 1 Time in 1 Post

    Default reading Continously from QTextStream

    hi
    i have a file which has floating values written in text format .so i have to use QTextStream to read the file and send it to socket repeatedly.

    Here the code

    Qt Code:
    1. QTextStream in(&file);
    2. while(1)
    3. {
    4. while(!in.atEnd())
    5. {
    6. double c;
    7. in>>c;
    8. char *data = (char*)(&c);
    9. socket->write(data,8);
    10. socket->flush();
    11. }
    12. in.seek(0);
    13. QCoreApplication::processEvents();
    14. }
    To copy to clipboard, switch view to plain text mode 

    It is supposed to send the file continously ,But the file is send just once and then it stops .What is wrong in the code.

    Thank u
    Last edited by jpn; 4th December 2008 at 19:51. Reason: changed [quote] to [code] tags

  2. #2
    Join Date
    Nov 2007
    Posts
    291
    Thanks
    85
    Thanked 1 Time in 1 Post

    Default Re: reading Continously from QTextStream

    When i run the client on the remote system the data is transferred continously .
    But when i run both the server and client on the same system only once the data is send.ie.The loop is never repeated. Strange.

  3. #3
    Join Date
    Nov 2007
    Posts
    291
    Thanks
    85
    Thanked 1 Time in 1 Post

    Default Re: reading Continously from QTextStream

    The problem is not with the number of systems.It was with the gnome terminal client ( guess ).

    With RHEL(redhat linux)-gnome-2.7.3
    I used Telnet as the client .After the data has received once it stopped collecting .But when i used the console(ALT+CTRL+F1) there was no problem.

    With opensuse11
    No problem.The data is getting continously.
    Last edited by babu198649; 2nd December 2008 at 12:30.

Similar Threads

  1. How to Compile VTKDesigner2 with Qt?
    By alfredoaal in forum Newbie
    Replies: 0
    Last Post: 5th September 2008, 05:34
  2. QTextStream loses position while reading file
    By bjh in forum Qt Programming
    Replies: 2
    Last Post: 13th February 2008, 15:47
  3. QWT 5, QT3, SuSE 10.2. Crash and burn
    By DrMcCleod in forum Qwt
    Replies: 8
    Last Post: 7th September 2007, 20:53
  4. reading from QTextStream
    By matyi52 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 14th December 2006, 07:26

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.