mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-28 19:55:48 +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)
|
void SendSystem::slot_sendFileBlockByteArray(QByteArray array, PacketType packetType)
|
||||||
{
|
{
|
||||||
if(client->getClientType() == TypeClientAutorization::TYPE_QT_CLIENT ||
|
if(client->getClientType() == TypeClientAutorization::TYPE_GUI)
|
||||||
client->getClientType() == TypeClientAutorization::TYPE_GUI)
|
|
||||||
{
|
{
|
||||||
QDataStream stream(socket);
|
QDataStream stream(socket);
|
||||||
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
stream.setVersion(QDataStream::Qt_DefaultCompiledVersion);
|
||||||
@@ -388,6 +387,37 @@ void SendSystem::slot_sendFileBlockByteArray(QByteArray array, PacketType packet
|
|||||||
{
|
{
|
||||||
QByteArray chunk = array.mid(bytesSended, sendFileBlockSize);
|
QByteArray chunk = array.mid(bytesSended, sendFileBlockSize);
|
||||||
stream << chunk;
|
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");
|
waitWrittenData("sendFileBlockByteArray");
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user