Example #1
0
bool FilePrinter::detectCupsService()
{
    QTcpSocket qsock;
    qsock.connectToHost("localhost", 631);
    bool rtn = qsock.waitForConnected() && qsock.isValid();
    qsock.abort();
    return rtn;
}
void QtNetworkPeerPrivate::sendMessage(const QByteArray &message)
{
    qDebug() << "sendMessage" << message;

    foreach (const QHostAddress &address, m_acceptedOutboundConnections.keys()) {
        qDebug() << "sendMessage" << address;
        QTcpSocket *socket = m_acceptedOutboundConnections.value(address);
        qDebug() << "socket" << socket->isValid() << socket->isOpen();
        socket->write(message);
        socket->flush();
    }
}
Example #3
0
void NetworkFrontend::NewConnection()
{
    qDebug() << "NetworkFrontend : NewConnection" ;
    qDebug() << "Connection arrivée !";
    QTcpSocket *tcpSocket;
    RemotePlayer *remotePlayer;

    tcpSocket = this->nextPendingConnection();

    if(!tcpSocket->isValid())
    {
        qDebug() << "Socket error" << endl;
        return;
    }

    remotePlayer = new RemotePlayer(tcpSocket, this->cardFactory);

    emit s_PlayerConnection(remotePlayer);
    qDebug() << "NetworkFrontend : Fin NewConnection" ;
}