Reputation: 63
I'm having a weird error. I'm trying to establish a connection to a server but the Server doesn't seem to start. Here's the Server.cpp:
Server::Server (QObject *parent) :
QTcpServer(parent)
{
}
void Server::start()
{
QHostAddress pHost;
pHost.setAddress("192.168.10.10"); //Setting the Address of the Server to the Address of the target system
QString printAddress;
printAddress = pHost.toString();
printf(QString("starting Host under " + printAddress + " \n").toStdString().c_str());
if (this->listen(pHost, 8016))
{
printf(QString("Server started and Listening \n").toStdString().c_str());
}
else
{
printf("Server could not be started \n");
}
}
In my main.cpp I instantiate the Server and call the method start.
Server pServer;
pServer.start();
this->listen(pHost, 8016) seems to be returning false because i get "Server could not be started" printed. What am I doing wrong? Why does the Server not start?
By the Way the Address 192.168.10.10 is the Address of another Computer in the local Network. Maybe that's why I'm getting an Error ?
I'm trying to establish a connection to that Device.
Any Help is highly appreciated !! Thank you !!
Upvotes: 0
Views: 129