mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
Работает сокет стрим
This commit is contained in:
@@ -364,8 +364,7 @@ void SendSystem::slot_sendFileBlock_forQtClient(QString path)
|
||||
|
||||
void SendSystem::slot_sendFileBlockByteArray(QByteArray array, PacketType packetType)
|
||||
{
|
||||
if(client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
|
||||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
|
||||
if(client->getClientType() == TypeClientAutorization::TYPE_GUI)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
@@ -388,12 +387,43 @@ void SendSystem::slot_sendFileBlockByteArray(QByteArray array, PacketType packet
|
||||
{
|
||||
QByteArray chunk = array.mid(bytesSended, sendFileBlockSize);
|
||||
stream << chunk;
|
||||
//bytesSended = socket->write(chunk);
|
||||
|
||||
waitWrittenData("sendFileBlockByteArray");
|
||||
|
||||
bytesSended += chunk.length();
|
||||
}
|
||||
}
|
||||
else if(client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT)
|
||||
{
|
||||
QDataStream stream(socket);
|
||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||
|
||||
qint64 size = array.size();
|
||||
qint64 bytesSended = 0;
|
||||
|
||||
if (size == 0)
|
||||
{
|
||||
Logger::instance().log(" WARNING! Zero size ",LogLevel::ERROR);
|
||||
return;
|
||||
}
|
||||
|
||||
stream << packetType; //Отправляем тип блока
|
||||
stream << size;
|
||||
|
||||
waitWrittenData("sendFileBlockByteArray");
|
||||
|
||||
while (bytesSended < size)
|
||||
{
|
||||
QByteArray chunk = array.mid(bytesSended, sendFileBlockSize);
|
||||
//stream << chunk;
|
||||
bytesSended = socket->write(chunk);
|
||||
|
||||
waitWrittenData("sendFileBlockByteArray");
|
||||
|
||||
bytesSended += chunk.length();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
slot_sendPacketType(packetType);
|
||||
|
||||
Reference in New Issue
Block a user