xgoan
23rd March 2007, 10:07
Hi.
I need to write a multi-threading QTcpServer only with QCoreApplication.
This is my main() function:
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;
}
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
I need to write a multi-threading QTcpServer only with QCoreApplication.
This is my main() function:
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;
}
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