Web: [skip ci] implement blocking tcp server

This commit is contained in:
wmayer
2020-05-20 16:52:36 +02:00
parent 8e7d521db7
commit e0de107817
3 changed files with 59 additions and 8 deletions

View File

@@ -151,6 +151,14 @@ void AppServer::customEvent(QEvent* e)
QByteArray msg = ev->request();
QTcpSocket* socket = ev->socket();
std::string str = runPython(msg);
socket->write(str.c_str());
socket->close();
}
std::string AppServer::runPython(const QByteArray& msg)
{
std::string str;
try {
@@ -175,8 +183,7 @@ void AppServer::customEvent(QEvent* e)
str = "Unknown exception thrown";
}
socket->write(str.c_str());
socket->close();
return str;
}
#include "moc_Server.cpp"