This repository has been archived on 2026-05-31. You can view files and clone it, but cannot push or open issues or pull requests.
Simon Stuerz 59c1157e57 client added, connection over tcp works
to do now: communication protocoll for json
2013-08-22 11:43:38 +02:00

44 lines
891 B
C++

#include "client.h"
#include <QDebug>
Client::Client(QObject *parent) :
QObject(parent)
{
m_tcpSocket = new QTcpSocket(this);
connect(m_tcpSocket, SIGNAL(error(QAbstractSocket::SocketError)), this, SLOT(connectionError(QAbstractSocket::SocketError)));
connect(m_tcpSocket, SIGNAL(connected()),this, SLOT(connectedToHost()));
}
void Client::connectionError(QAbstractSocket::SocketError error)
{
qDebug() << "---> connection error:" << error;
}
void Client::readData()
{
}
void Client::connectedToHost()
{
qDebug() << "connected to hive server";
}
void Client::connectToHost(QString ipAddress, QString port)
{
m_tcpSocket->connectToHost(QHostAddress(ipAddress), port.toInt());
}
void Client::disconnectFromHost()
{
m_tcpSocket->close();
qDebug() << "connection to hive server closed";
}
void Client::sendData(QString target, QString command)
{
}