From 97eea0e71ccbc72044822a6f00808e72df4b08c7 Mon Sep 17 00:00:00 2001 From: McDj26 <2645370670@qq.com> Date: Tue, 27 Dec 2022 17:31:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=8F=E6=94=B9=E5=8A=A8,=E6=8F=90=E9=AB=98?= =?UTF-8?q?=E7=BD=91=E7=BB=9C=E7=A8=B3=E5=AE=9A=E6=80=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- LibManageSystem_Server/mythread.cpp | 4 +- LibManagementSystem/communication_module.cpp | 70 +++++++++++--------- 2 files changed, 39 insertions(+), 35 deletions(-) diff --git a/LibManageSystem_Server/mythread.cpp b/LibManageSystem_Server/mythread.cpp index 64e58d0..c47ca92 100644 --- a/LibManageSystem_Server/mythread.cpp +++ b/LibManageSystem_Server/mythread.cpp @@ -584,7 +584,7 @@ void MyThread::FirstTransfer() cur_msg=first_transfer_header + msg_tobe_sent.sliced(0,MAX_DAT_SIZE_PER_CLOCK); cur_msg=HammingEncode(cur_msg); socket->write(cur_msg); - socket->waitForReadyRead(500); + socket->waitForReadyRead(550); } //更新发送进度 @@ -621,7 +621,7 @@ void MyThread::ContinueTransfer() sentsize+=MAX_DAT_SIZE_PER_CLOCK; cur_msg=HammingEncode(cur_msg); socket->write(cur_msg); - socket->waitForReadyRead(500); + socket->waitForReadyRead(550); } //更新发送进度 diff --git a/LibManagementSystem/communication_module.cpp b/LibManagementSystem/communication_module.cpp index 3f7cca1..5216ab6 100644 --- a/LibManagementSystem/communication_module.cpp +++ b/LibManagementSystem/communication_module.cpp @@ -245,43 +245,47 @@ void communication_module::processMsg() case 'A': //账号操作 start=8; - if(received_msg[7]=='A'){ - *doHostAccept=true; - emit msg_received(); - } - else{ - if(received_msg[7]=='R'){ - *doHostAccept=false; - start=7; - RejectInfo=pickout(received_msg,start,stopChar); - emit sendfail(RejectInfo); - } - else - emit sendfail("错误原因:收到了无效的数据"); - } - if(received_msg[6]=='2'&&*doHostAccept){ - //登录操作,获取账号详细信息 - tempuser.account=pickout(received_msg,start,stopChar); - tempuser.nickname=pickout(received_msg,start,stopChar); - tempuser.password=pickout(received_msg,start,stopChar); - tempuser.sex=pickout(received_msg,start,stopChar); - tempuser.telephone_number=pickout(received_msg,start,stopChar); - tempuser.email=pickout(received_msg,start,stopChar); - for(i=0;i<5;i++) - tempuser.borbook[i]=pickout(received_msg,start,stopChar); - tempuser.appointedbook=pickout(received_msg,start,stopChar); - for(i=0;i<5;i++) - tempuser.returnddl[i]=pickout(received_msg,start,stopChar); - tempuser.message=pickout(received_msg,start,stopChar); - if(start!=-1){ - //数据接收后长度不符合预期,判定为接收失败 - emit sendfail("错误原因:处理服务器返回的数据时出错"); + if(received_msg[6]>='1'&&received_msg[6]<='3'){ + if(received_msg[7]=='A'){ + *doHostAccept=true; + emit msg_received(); } else{ - *user=tempuser; - emit msg_received(); + if(received_msg[7]=='R'){ + *doHostAccept=false; + start=7; + RejectInfo=pickout(received_msg,start,stopChar); + emit sendfail(RejectInfo); + } + else + emit sendfail("错误原因:收到了无效的数据"); + } + if(received_msg[6]=='2'&&*doHostAccept){ + //登录操作,获取账号详细信息 + tempuser.account=pickout(received_msg,start,stopChar); + tempuser.nickname=pickout(received_msg,start,stopChar); + tempuser.password=pickout(received_msg,start,stopChar); + tempuser.sex=pickout(received_msg,start,stopChar); + tempuser.telephone_number=pickout(received_msg,start,stopChar); + tempuser.email=pickout(received_msg,start,stopChar); + for(i=0;i<5;i++) + tempuser.borbook[i]=pickout(received_msg,start,stopChar); + tempuser.appointedbook=pickout(received_msg,start,stopChar); + for(i=0;i<5;i++) + tempuser.returnddl[i]=pickout(received_msg,start,stopChar); + tempuser.message=pickout(received_msg,start,stopChar); + if(start!=-1){ + //数据接收后长度不符合预期,判定为接收失败 + emit sendfail("错误原因:处理服务器返回的数据时出错"); + } + else{ + *user=tempuser; + emit msg_received(); + } } } + else + emit sendfail("错误原因:收到了无效的数据"); break; case 'I': //获取图片操作 -- Gitee