Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, June 2007
How to break cycle when peer is lost


Message 1 in thread

Hi again,

  I want break one cycle, in which I read data from file and write them  
into tcpSocket, when the peer is lost.

Example:
  I transfer some big file (100MiB or greater). The transfer runs and when  
I kill client the cycle in the serverthread continues until all data from  
source file have been read.

  I try to test QTcpSocket.isValid(), QTcpSocket.state(),  
QTcpSocket.error() but without success.

  Then I try tcpSocket.waitForBytesWritten(5000) .. the cycle is  
discontinued but I get this error "QAbstractSocket::waitForDisconnected()  
is not allowed in UnconnectedState" and is discontiued immediately  
(without waiting for 5sec).

  The source code is attached. The cycle which I mean is in  
/server/znsynserverthread.cpp under the comment "// THIS CYCLE I WANT TO  
BREAK WHEN THE PEER IS LOST". You should change the filename of the shared  
file "#define SHARED_FILE ...".

Thanks for your advice and time, I'm newbie in Qt. Sorry for my english.
-- 
 [ signature omitted ]