This commit is contained in:
semenov
2024-08-29 10:03:59 +03:00
parent 3e43e897e7
commit c0ab6b1649
24 changed files with 353 additions and 156 deletions

View File

@@ -7,7 +7,7 @@
TCPClient::TCPClient(QObject *parent) :
QObject(parent)
{
socket = NULL;
}
void TCPClient::Initialize(RecognizeSystem *recognize,ExternalExecuter *externalExecuter)
@@ -20,6 +20,12 @@ void TCPClient::Initialize(RecognizeSystem *recognize,ExternalExecuter *external
void TCPClient::SetConnect(ServerSettings *serverSettings)
{
if (socket != NULL && socket->state() == QTcpSocket::ConnectedState)
{
emit onSendDebugLog("already connected");
return;
}
socket = new QTcpSocket(this);
connect(socket,&QTcpSocket::readyRead,this,&TCPClient::onReadyRead,Qt::DirectConnection);
@@ -91,6 +97,14 @@ void TCPClient::SendFile()
countSend = 0;
}
void TCPClient::SendUnityConnect()
{
QDataStream stream(socket);
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
stream << PacketType::TYPE_CHANGEPACKAGERESPONSE;
socket->waitForBytesWritten();
}
void TCPClient::SetDisconnect()
{
socket->disconnect();