void MRmiServerPrivateSocket::_q_incoming()
{
    Q_Q(MRmiServer);
    QLocalSocket* s = _serv.nextPendingConnection();
    q->connect(s, SIGNAL(disconnected()), s, SLOT(deleteLater()));
    if (!s)
        return;
    q->connect(s, SIGNAL(readyRead()), this, SLOT(_q_readData()));
}
Exemple #2
0
void IrcSession::setSocket(QAbstractSocket* socket)
{
    Q_D(IrcSession);
    if (d->socket != socket)
    {
        if (d->socket)
        {
            d->socket->disconnect(this);
            if (d->socket->parent() == this)
                d->socket->deleteLater();
        }

        d->socket = socket;
        if (socket)
        {
            connect(socket, SIGNAL(connected()), this, SLOT(_q_connected()));
            connect(socket, SIGNAL(disconnected()), this, SLOT(_q_disconnected()));
            connect(socket, SIGNAL(readyRead()), this, SLOT(_q_readData()));
            connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(_q_error(QAbstractSocket::SocketError)));
            connect(socket, SIGNAL(stateChanged(QAbstractSocket::SocketState)), this, SLOT(_q_state(QAbstractSocket::SocketState)));
        }
    }
}