PDA

View Full Version : reading Continously from QTextStream



babu198649
2nd December 2008, 07:58
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



QTextStream in(&file);
while(1)
{
while(!in.atEnd())
{
double c;
in>>c;
char *data = (char*)(&c);
socket->write(data,8);
socket->flush();
}
in.seek(0);
QCoreApplication::processEvents();
}

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

babu198649
2nd December 2008, 10:21
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.

babu198649
2nd December 2008, 11:15
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.