View Full Version : QT3 - detecting peer

7th October 2009, 15:26
I am writing a small client server application and I came upon a small problem (for qt experts), but quite big for me.

How can the Client see if there is a server present without communicating with him .?

For client I am using QSocketDevice.
Here is a small sequence of code.

_socket = new QSocketDevice(QSocketDevice::Stream);
bConnect = _socket->connect(_addr, _port);
if(true == bConnect)
//do something

as you can see I have tried using connect function. I allways get bConnect==false. However I know the connection is properly made because later on if I ignor the "if(true == bConnect)" ...I get incoming data from server...
So...any other ideeas

Thank you

7th October 2009, 17:41
QTcpSocket communication achieved through signals and slots. The client has to communication with the server to connect to it. I suggest looking at some of the network examples that come with Qt http://qt.nokia.com/doc/4.5/examples.html#network

7th October 2009, 18:44
I am using qt 3. I have no Qtcpsocket. :(