#include "tcpserver.h"
#include <QMessageBox>
static QString data_big;
tcpserver::tcpserver(QObject *parent) : QObject(parent)
{
mSocket = new QTcpSocket(this);
mSocket->connectToHost("127.0.0.1", 6000);
if(mSocket->waitForConnected(1000)) {
qDebug() << "[Client] Client succesfull conneted to the server!";
} else {
QMessageBox::warning(0,"Error", "Error with connecting to the server!");
}
}
QString tcpserver::recieveData1()
{
mSocket->waitForBytesWritten(1000);
qDebug() << "[Client] write - " << data_big;
mSocket->write(data_big.toUtf8());
mSocket->waitForReadyRead(3000);
QString answ = mSocket->readAll();
qDebug() << "[Server] reply - " << answ;
return answ;
}
void tcpserver::sendedData(QString data)
{
data_big = data;
}