示例#1
0
AtlantikNetwork::AtlantikNetwork(AtlanticCore *atlanticCore) : KExtendedSocket(0, 0, KExtendedSocket::inputBufferedSocket)
{
	m_atlanticCore = atlanticCore;
	m_textStream = new QTextStream(this);
	m_textStream->setCodec(QTextCodec::codecForName("utf8"));
	m_playerId = -1;
	m_serverVersion = "";

	QObject::connect(this, SIGNAL(readyRead()), this, SLOT(slotRead()));
	QObject::connect(this, SIGNAL(lookupFinished(int)),
	                 this, SLOT(slotLookupFinished(int)));
	QObject::connect(this, SIGNAL(connectionSuccess()),
	                 this, SLOT(slotConnectionSuccess()));
	QObject::connect(this, SIGNAL(connectionFailed(int)),
	                 this, SLOT(slotConnectionFailed(int)));
}
示例#2
0
Result
AsyncCDDBPLookup::lookup
(
    const QString         & hostname,
    uint                    port,
    const TrackOffsetList & trackOffsetList
)
{
    socket_ = new QTcpSocket;
    socket_->connectToHost(hostname, port);

    connect (socket_, SIGNAL(error(QAbstractSocket::SocketError)), SLOT(slotGotError(QAbstractSocket::SocketError)));

    connect (socket_, SIGNAL(connected()),
             SLOT(slotConnectionSuccess()) );

    connect (socket_, SIGNAL(readyRead()), SLOT(slotReadyRead()) );

    trackOffsetList_ = trackOffsetList;

    state_ = WaitingForConnection;

    return Success;
}