QTfrontend/tcpBase.cpp
changeset 390 dca6bd77d71d
parent 389 9628e69b609f
child 419 fdeed9718e6b
equal deleted inserted replaced
389:9628e69b609f 390:dca6bd77d71d
    31 TCPBase::TCPBase(bool demoMode) :
    31 TCPBase::TCPBase(bool demoMode) :
    32   m_isDemoMode(demoMode),
    32   m_isDemoMode(demoMode),
    33   IPCSocket(0)
    33   IPCSocket(0)
    34 {
    34 {
    35   if(!IPCServer) {
    35   if(!IPCServer) {
    36     IPCServer = new QTcpServer(this);
    36     IPCServer = new QTcpServer(0);
    37     IPCServer->setMaxPendingConnections(1);
    37     IPCServer->setMaxPendingConnections(1);
    38     if (!IPCServer->listen(QHostAddress::LocalHost)) {
    38     if (!IPCServer->listen(QHostAddress::LocalHost)) {
    39       QMessageBox::critical(0, tr("Error"),
    39       QMessageBox::critical(0, tr("Error"),
    40 			    tr("Unable to start the server: %1.")
    40 			    tr("Unable to start the server: %1.")
    41 			    .arg(IPCServer->errorString()));
    41 			    .arg(IPCServer->errorString()));
    78 
    78 
    79   readbuffer.clear();
    79   readbuffer.clear();
    80 
    80 
    81   if(srvsList.size()==1) srvsList.pop_front();
    81   if(srvsList.size()==1) srvsList.pop_front();
    82   emit isReadyNow();
    82   emit isReadyNow();
       
    83   deleteLater();
    83 }
    84 }
    84 
    85 
    85 void TCPBase::ClientRead()
    86 void TCPBase::ClientRead()
    86 {
    87 {
    87   readbuffer.append(IPCSocket->readAll());
    88   readbuffer.append(IPCSocket->readAll());
    95 			.arg(error) + bindir->absolutePath() + "/hwengine)");
    96 			.arg(error) + bindir->absolutePath() + "/hwengine)");
    96 }
    97 }
    97 
    98 
    98 void TCPBase::tcpServerReady()
    99 void TCPBase::tcpServerReady()
    99 {
   100 {
   100   disconnect(srvsList.front(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
   101   disconnect(srvsList.takeFirst(), SIGNAL(isReadyNow()), this, SLOT(tcpServerReady()));
   101   srvsList.pop_front();
       
   102 
   102 
   103   RealStart();
   103   RealStart();
   104 }
   104 }
   105 
   105 
   106 void TCPBase::Start()
   106 void TCPBase::Start()