mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +03:00
ref: send system
This commit is contained in:
@@ -19,7 +19,7 @@ kanban-plugin: board
|
|||||||
## TODO
|
## TODO
|
||||||
|
|
||||||
- [ ] выдавать trainee_id при авторизации
|
- [ ] выдавать trainee_id при авторизации
|
||||||
- [ ] изменить путь до самостоятельного /RRJ-95NEW-100/tasksFIM.xml и AMM
|
- [ ] /RRJ-95NEW-100/tasksFIM.xml и AMM на /RUS/Scens/tasksFIM.xml и AMM
|
||||||
- [ ] Убрать ошибки QObject::moveToThread: Cannot move objects with a parent
|
- [ ] Убрать ошибки QObject::moveToThread: Cannot move objects with a parent
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ InstructorsAndTraineesWidget::InstructorsAndTraineesWidget(QWidget *parent) :
|
|||||||
ui->groupBox_Trainees->setObjectName("groupBox_Trainees");
|
ui->groupBox_Trainees->setObjectName("groupBox_Trainees");
|
||||||
|
|
||||||
#ifndef PROJECT_TYPE_DEBUG
|
#ifndef PROJECT_TYPE_DEBUG
|
||||||
ui->btnUpdateStyleSheet->setVisible(false);
|
//ui->btnUpdateStyleSheet->setVisible(false);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
qRegisterMetaType<PacketType>("PacketType");
|
qRegisterMetaType<PacketType>("PacketType");
|
||||||
|
|||||||
@@ -198,34 +198,25 @@ void SendSystem::sendXmlAnswer(QByteArray array, PacketType packetType)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
//QByteArray buffer(512,0);
|
||||||
QByteArray buffer(512,0);
|
|
||||||
QByteArray message;
|
QByteArray message;
|
||||||
message.append("size=");
|
message.append("size=");
|
||||||
message.append(QByteArray::number(array.length()));
|
int size = array.length();
|
||||||
|
message.append(reinterpret_cast<char*>(&size), sizeof(int));
|
||||||
|
|
||||||
memcpy(buffer.data(),message,message.length());
|
qDebug() << "Message size " << message.length();
|
||||||
qDebug() << buffer.length();
|
qDebug() << array.length();
|
||||||
socket->write(buffer);
|
socket->write(message);
|
||||||
socket->waitForBytesWritten();
|
|
||||||
|
|
||||||
if(array.length() <= 512)
|
if(array.length() <= 512)
|
||||||
{
|
{
|
||||||
QByteArray buffer2(512,0);
|
// QByteArray buffer2(512,0);
|
||||||
memcpy(buffer2.data(),array.data(),array.length());
|
// memcpy(buffer2.data(),array.data(),array.length());
|
||||||
socket->write(buffer2);
|
socket->write(array);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
buffer.clear();
|
socket->write(array);
|
||||||
QDataStream stream(array);
|
|
||||||
|
|
||||||
while(!stream.atEnd())
|
|
||||||
{
|
|
||||||
stream >> buffer;
|
|
||||||
socket->write(array);
|
|
||||||
socket->waitForBytesWritten();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -145,7 +145,7 @@ bool ServerLMSWidget::stopServer()
|
|||||||
//Закрываем все открытые сокеты
|
//Закрываем все открытые сокеты
|
||||||
foreach(int idSocket, clientsMap.keys())
|
foreach(int idSocket, clientsMap.keys())
|
||||||
{
|
{
|
||||||
clientsMap[idSocket]->sigSocketWrite(arrayAnswer);
|
clientsMap[idSocket]->sigSendXmlAnswer(arrayAnswer,PacketType::TYPE_XMLANSWER);
|
||||||
//while (!clientsMap[idSocket]->sigSocketFlush()) {}
|
//while (!clientsMap[idSocket]->sigSocketFlush()) {}
|
||||||
|
|
||||||
QString str = QString(arrayAnswer);
|
QString str = QString(arrayAnswer);
|
||||||
|
|||||||
Reference in New Issue
Block a user