PDA

View Full Version : (NETWORKING) intranet client server communication fails



marco.stanzani
3rd August 2011, 09:54
hello
i am building a c/s application with a server resident on a different computer than those hosting the client.
to begin with, i successfully run both server and client are running on the *same* PC (IP address 192.168.0.8).
then i wanted to make things a bit more difficult, trying to make the communication up and running in my home intranet, i.e. the server is running on a different computer than the client: i.e. server at IP address 192.168.0.13, while the client is running on a different computer at 192.168.0.8 and this does not work: the client cannot listen to the server using IP address and port nr. of the server,

Qt code is as following:
This is for creating connection


tcpKeysFromServer = new QTcpServer(this);
connect(tcpKeysFromServer, SIGNAL(newConnection()), this, SLOT(acceptConnectionFromKeysServer()));

this is to check client is listening (which is failing)


if (!tcpKeysFromServer->isListening() && ! tcpKeysFromServer -> listen (QHostAddress (m_ipAddressKeysServer), m_FromPortKeysServer) )
{
QString newLabelSvrName = tr("Unable to start KEYS server: check IP address!");
ui.labelFromKeysServer->setText(newLabelSvrName);
}