QTcpSocket does not emit signals



  • Hi all, I am having problems with QTcpSocket, it's not emitting any signals :/
    @
    void NetworkInstance::run()
    {
    m_pSocket = new QTcpSocket();
    qDebug() << "Conencting signal";
    connect(m_pSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError()));
    connect(m_pSocket, SIGNAL(hostFound()), this, SLOT(socketHostLookupDone()));
    connect(m_pSocket, SIGNAL(connected()), this, SLOT(socketConnected()));
    connect(m_pSocket, SIGNAL(disconnected()), this, SLOT(socketDisconnected()));

    connect(m_pSocket, SIGNAL(readyRead()), this, SLOT(socketReadyRead()));
    qDebug() << "Done";
    
    QSettings s;
    s.beginGroup("network");
    emit log(QString("Connection to: ").append(s.value("host").toString()).append(":").append(s.value("port").toString()));
    m_pSocket->connectToHost(s.value("host").toString(), s.value("port").toInt());
    s.endGroup();
    
    exec&#40;&#41;;
    

    }
    @
    This is my code, I don't see any error in it, but non of the connected signal is emitting (hostFound, connected, etc.). On server I can see that connection is established and data sent, but nothing happens on client end. The NetworkInstance is extenting QThread.


Log in to reply