diff --git a/LibManageSystem_Server/mythread.cpp b/LibManageSystem_Server/mythread.cpp index 64e58d070de2531dfa57773d31a9849fc9925d2f..c47ca92b657714a70f58559f347d4206abc15c7b 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 3f7cca17833437118552fbaf23226bdd6309cf94..5216ab653b7ae00a25ffb42fc34e49ce46080dcd 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': //获取图片操作