QTfrontend/netserver.cpp
changeset 672 08ed55ea1e2a
parent 658 a7e625f5d9d0
child 749 3acf2371d73c
equal deleted inserted replaced
671:a8970859f50e 672:08ed55ea1e2a
    23 #include <QTcpSocket>
    23 #include <QTcpSocket>
    24 #include <QMessageBox>
    24 #include <QMessageBox>
    25 
    25 
    26 extern char delimeter;
    26 extern char delimeter;
    27 
    27 
    28 void HWNetServer::StartServer(quint16 port)
    28 bool HWNetServer::StartServer(quint16 port)
    29 {
    29 {
    30   ds_port = port;
    30   ds_port = port;
    31   hhnum=0;
    31   hhnum=0;
    32   IPCServer = new QTcpServer(this);
    32   IPCServer = new QTcpServer(this);
    33   if (!IPCServer->listen(QHostAddress::Any, ds_port)) {
       
    34     QMessageBox::critical(0, tr("Error"),
       
    35 			  tr("Unable to start the server: %1.")
       
    36 			  .arg(IPCServer->errorString()));
       
    37   }
       
    38 
    33 
    39   connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
    34   connect(IPCServer, SIGNAL(newConnection()), this, SLOT(NewConnection()));
       
    35 
       
    36   return IPCServer->listen(QHostAddress::Any, ds_port);
    40 }
    37 }
    41 
    38 
    42 void HWNetServer::StopServer()
    39 void HWNetServer::StopServer()
    43 {
    40 {
    44   QList<HWConnectedClient*>::iterator it;
    41   QList<HWConnectedClient*>::iterator it;