PDA

View Full Version : QTcpSocket and waitforconnected 4.4.3.



Simo
20th April 2010, 14:56
hi all,

in a TCP-client I wrote the following lines to connect to a TCP-server:

//Start the process (the other software) - runs ok
this->process.start(path,arguments);

//..some 100msec later the software is started and the other software starts a TCP-server...
if(!this->process.waitForStarted(WAIT_FOR_STARTED_ADDON_TIME OUT_MSEC))
return ERR_ADDONS_ADDON_NOT_STARTED;

//Connect to the the server e.g. at port 10005
this->pTcpSocket->connectToHost("127.0.0.1",this->ulPortNumber);

//Wait or connected over some seconds, I set the time up to 30 sec
if(!this->pTcpSocket->waitForConnected (WAIT_FOR_CONNECT_ADDON_TIMEOUT_MSEC))
return ERR_ADDONS_ADDON_NOT_CONNECTED;

This runs on a fast machine ok, but on a slow and low performance IPC a creazy behaviour is visible if we log the activities of both applications:

-->The server starts after starting the server-application ok (and waits for clients),
-->The WAIT_FOR_CONNECT_TIMEOUT_MSEC-time is passing by...
-->Just when the clients-"waitForConnect-timeout"-Time (WAIT_FOR_CONNECT_ADDON_TIMEOUT_MSEC) is over the other application reports a "connect"-event of the client. but because the client came into a timeout the server says "deconnected gracefully" :(

So no connection is established. any idea ?

best regards

Simon