PDA

View Full Version : QTcpSocket: ConnectingState



fruzzo
29th July 2009, 10:35
Hi,
I've created a simple server-client application and I've a problem abouot the QTcpSocket.
The client request a new connection to the server, this one accept it, but the status of the socket created remain always in ConnectingState.
Is there somebody that know why?

Attached there is my code.

N.B. I'm using Qt 4.3.5.

caduel
29th July 2009, 11:43
because the server can accept multiple connections?

fruzzo
29th July 2009, 14:21
because the server can accept multiple connections?

What do you means?
The maximum number of pending accepted connections are the default one so...30.

Another thing...the instance of TcpRadioHandler is done (both server and client) in the run() of a QThread.

vratojr
30th July 2009, 09:34
.......................................

fruzzo
30th July 2009, 09:40
Any idea about the problem?

yogeshgokul
30th July 2009, 10:04
What do you means?
The maximum number of pending accepted connections are the default one so...30.
Can you forget the state for time being and transfer the data over socket meanwhile. So we can see, the problem.

navi1084
30th July 2009, 10:12
Sorry-----------------------------------

fruzzo
11th August 2009, 14:25
Solved...just after the connectToHost I insert an waitForConnected:

socket->connectToHost(hostIp, hostPort);
if (socket->waitForConnected(1000))
qDebug("Connected!");

No I've another kind of problem...After client-server are connected when I sent a message (msg#1) from client to server, the server must response with another message (msg#2) just after the first one but I've a strange behaviour. The msg#1 is received by server with a little bit latency after sended by client (some milliseconds) instead the msg#2 is received by client after 2-3 seconds. why?