Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QTcpSocket does not emit signals
Forum Updated to NodeBB v4.3 + New Features

QTcpSocket does not emit signals

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 840 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    paladin
    wrote on last edited by
    #1

    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.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved