TSock::TSock(QTcpSocket *sock, QObject *parent) : QObject(parent), listenPort(0) { if (sock == NULL) socket = new QTcpSocket; else socket = sock; connect(socket, SIGNAL(connected()), this, SLOT(socketConnected())); connect(socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); connect(socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError(QAbstractSocket::SocketError))); connect(socket, SIGNAL(readyRead()), this, SLOT(socketDataReady())); connect(&server, SIGNAL(newConnection()), this, SLOT(serverConnection())); }
CBNLSClient :: CBNLSClient( QString nServer, quint16 nPort, quint32 nWardenCookie ) { m_Socket = new QTcpSocket( ); QObject::connect(m_Socket, SIGNAL(connected()), this, SLOT(socketConnected())); QObject::connect(m_Socket, SIGNAL(disconnected()), this, SLOT(socketDisconnected())); QObject::connect(m_Socket, SIGNAL(readyRead()), this, SLOT(socketDataReady())); QObject::connect(m_Socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(socketError())); QObject::connect(&m_NULLTimer, SIGNAL(timeout()), this, SLOT(timeout_NULL())); m_NULLTimer.setInterval(50000); m_Protocol = new CBNLSProtocol( ); m_WasConnected = false; m_Server = nServer; m_Port = nPort; m_LastNullTime = 0; m_WardenCookie = nWardenCookie; m_TotalWardenIn = 0; m_TotalWardenOut = 0; m_Retries = 0; }