//-------------------------------------------------------------------------------------------------- /// //-------------------------------------------------------------------------------------------------- void RiaSocketServer::handleClientConnection(QTcpSocket* clientToHandle) { CVF_ASSERT(clientToHandle != NULL); CVF_ASSERT(m_currentClient == NULL); m_currentClient = clientToHandle; // Initialize state varianbles m_currentCommandSize = 0; m_scalarResultsToAdd = NULL; m_timeStepCountToRead = 0; m_bytesPerTimeStepToRead = 0; m_currentTimeStepToRead = 0; m_currentReservoir = NULL; m_currentScalarIndex = cvf::UNDEFINED_SIZE_T; m_currentPropertyName = ""; connect(m_currentClient, SIGNAL(disconnected()), this, SLOT(slotCurrentClientDisconnected())); if (m_currentClient->bytesAvailable()) { this->slotReadCommand(); } connect(m_currentClient, SIGNAL(readyRead()), this, SLOT(slotReadCommand())); }
void Dialog::slotConnected() { qDebug("[Dialog::slotConnected()]"); if ( m_socket ) { m_socket->disconnectFromServer(); m_socket = 0; } m_socket = m_server->nextPendingConnection(); if ( m_socket ) { connect(m_socket, SIGNAL(readyRead()), this, SLOT(slotReadCommand())); connect(m_socket, SIGNAL(disconnected()), this, SLOT(deleteLater())); qDebug("[Dialog::slotConnected()] next socket"); } }