Пример #1
0
ClientSocket::ClientSocket(unsigned int playerID, QTcpSocket *socket, QObject *parent) :
    QObject(parent), playerID(playerID)
{
    this->socket = socket;
    connect(this->socket, SIGNAL(readyRead()), this, SLOT(gotReadyRead()));
    connect(this->socket, SIGNAL(disconnected()), this, SLOT(gotDisconnected()));
}
Пример #2
0
LWDAQ_Client::LWDAQ_Client(QString host, quint16 port, QObject *parent) : QObject(parent),
                                  hostName(host),
                                  portNo(port),
                                  currentState(UNSET),
                                  cmdNo(0),
                                  error(false),
                                  errorText("") {

    tcpSocket = new QTcpSocket(this);

    connect(tcpSocket, SIGNAL(connected()), this, SLOT(gotConnected()));
    connect(tcpSocket, SIGNAL(disconnected()), this, SLOT(gotDisconnected()));
    connect(tcpSocket, SIGNAL(readyRead()), this, SLOT(readStatus()));
    connect(tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)),
                this, SLOT(displayError(QAbstractSocket::SocketError)));

    connectTimer = new QTimer(this);
    connectTimer->setInterval(RECONNECT_TIME*1000);
    connectTimer->setSingleShot(true);
    connect(connectTimer, SIGNAL(timeout()), this, SLOT(init()));

    statusTimer = new QTimer(this);
    statusTimer->setInterval(SLOW_UPDATE_TIME*1000);
    statusTimer->setSingleShot(false);
    connect(statusTimer, SIGNAL(timeout()), this, SLOT(updateStatus()));

    runTimer = new QTimer(this);
    runTimer->setInterval(DEFAULT_RUN_TIME*1000);
    runTimer->setSingleShot(true);
    connect(runTimer, SIGNAL(timeout()), this, SLOT(stopRun()));
}
Пример #3
0
void IrcLayer::ircConnect()
{
	m_active=true;
	if (!m_ircServer->contact())
	{
		//qDebug("We are connected! Joining...");
		if(targetMode()==ChannelMode)
		{
			//qDebug() << "Joining " << m_target << __LINE__;
			ircJoin(target());
		}
	}
	else
	{
		//qDebug("No we aren't");
		infMsg(tr("Contacting IRC server..."));
	}
	connect(m_ircServer, SIGNAL(connected()), this, SLOT(ircLogon()));
	connect(m_ircServer, SIGNAL(gotLine(QByteArray)), this, SLOT(ircParse(QByteArray)));
	connect(m_ircServer, SIGNAL(disconnected()), this, SLOT(gotDisconnected()));
}