Hi.
I need to write a multi-threading QTcpServer only with QCoreApplication.
This is my main() function:
int main(int argc, char *argv[]){
Server server;
message("Server init...");
message("Server can't be initiated");
return -1;
}
message("Server initiated");
while(server.isListening());
message("Server closed");
return 0;
}
int main(int argc, char *argv[]){
QCoreApplication app(argc, argv);
Server server;
message("Server init...");
if(!server.listen(QHostAddress::Any, port)){
message("Server can't be initiated");
return -1;
}
message("Server initiated");
while(server.isListening());
message("Server closed");
return 0;
}
To copy to clipboard, switch view to plain text mode
But it nevers enters in the Server::incomingConnection(int socketDescriptor) function. I suspect that the problem is with while(server.isListening()); but I haven't found any example for QtCore apps, only for QtGui
Thanks
Bookmarks