void tvNetworkControl::connectToTV(const QString & ip) { if (m_socket) { delete m_socket; } m_socket = new QTcpSocket(this); m_socket->connectToHost(ip, 55000); connect(m_socket, SIGNAL(connected()), this, SLOT(sltConnected())); connect(m_socket, SIGNAL(disconnected()), this, SLOT(sltDisconnected())); connect(m_socket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(sltError(QAbstractSocket::SocketError))); connect(m_socket, SIGNAL(readyRead()), this, SLOT(sltReadyRead())); }
ServiceClient::ServiceClient(QObject *parent) : QObject(parent) { m_qTcpSocket = new QTcpSocket(this); connect(m_qTcpSocket, SIGNAL(connected()), this, SLOT(sltConnected())); connect(m_qTcpSocket, SIGNAL(disconnected()), this, SLOT(sltDisconnected())); connect(m_qTcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(reportError(QAbstractSocket::SocketError)), Qt::DirectConnection); connect(m_qTcpSocket, SIGNAL(readyRead()), this, SLOT(readFromSocket()), Qt::DirectConnection); #if Q_BYTE_ORDER == Q_LITTLE_ENDIAN m_bIsLittleEndian = true; #endif #if Q_BYTE_ORDER == Q_BIG_ENDIAN m_bIsLittleEndian = false; #endif }