mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJClient.git
synced 2026-03-28 05:25:39 +03:00
bugfix: long connection
This commit is contained in:
@@ -30,21 +30,11 @@ void TCPClient::setConnect(ServerSettings *serverSettings)
|
||||
|
||||
connect(socket,&QTcpSocket::readyRead,this,&TCPClient::slotReadyRead,Qt::DirectConnection);
|
||||
connect(socket,&QTcpSocket::disconnected,this,&TCPClient::setDisconnect);
|
||||
connect(socket,&QTcpSocket::connected,this,&TCPClient::slotConnectNotify);
|
||||
connect(this,&TCPClient::sigRecognize,recognizeSystem,&RecognizeSystem::recognize,Qt::DirectConnection);
|
||||
|
||||
socket->connectToHost(serverSettings->Address,serverSettings->Port.toShort());
|
||||
emit sigSendDebugLog("Try connect...");
|
||||
|
||||
socket->waitForReadyRead();
|
||||
|
||||
if(socket->state() != QTcpSocket::ConnectedState){
|
||||
emit sigSendDebugLog("Connect invalid");
|
||||
emit sigConnectionState(false);
|
||||
return;
|
||||
}else{
|
||||
emit sigSendDebugLog("Connect complete");
|
||||
emit sigConnectionState(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TCPClient::sendClientAutorization()
|
||||
@@ -167,6 +157,18 @@ void TCPClient::slotMessageEntered(QString message)
|
||||
}
|
||||
}
|
||||
|
||||
void TCPClient::slotConnectNotify()
|
||||
{
|
||||
if(socket->state() != QTcpSocket::ConnectedState){
|
||||
emit sigSendDebugLog("Connect invalid");
|
||||
emit sigConnectionState(false);
|
||||
return;
|
||||
}else{
|
||||
emit sigSendDebugLog("Connect complete");
|
||||
emit sigConnectionState(true);
|
||||
}
|
||||
}
|
||||
|
||||
void TCPClient::slotReadyRead()
|
||||
{
|
||||
if(!socket){
|
||||
|
||||
@@ -41,6 +41,7 @@ signals:
|
||||
|
||||
public slots:
|
||||
void slotMessageEntered(QString message);
|
||||
void slotConnectNotify();
|
||||
|
||||
private slots:
|
||||
void slotReadyRead();
|
||||
|
||||
Reference in New Issue
Block a user