我遇到一个问题,当我发送大数据包(5 000字节)时,数据包在发送之前被删除,因此服务器崩溃。
有没有办法在发送时删除数据包?
没有删除[]服务器可以正常工作。
这是代码:
case 675:
char * datax;
datax = new char [5824]();
datax[0] = 0xc0;
datax[1] = 0x16;
datax[4] = 4;
datax[6] = 1;
datax[8] = 1;
datax[10] = 1;
datax[12] = 0xb1;
datax[13] = 0x09;
datax[20] = 1;
datax[24] = 0x16;
datax[28] = 0x05;
datax[29] = 0x09;
datax[30] = 0x0e;
datax[5801] = 0xc0;//coords
datax[5802] = 0xb7;
datax[5803] = 0xc4;
datax[5805] = 0xe0;
datax[5806] = 0x21;
datax[5807] = 0x45;//end
datax[5808] = 0x0c;
datax[5813] = 0x9d;
datax[5814] = 0x0f;
datax[5815] = 0xbf;
datax[5822] = 0x52;
datax[5823] = 0x2a;
_socket.sendBytes(datax, 5824);
delete [] datax; //here crash
break;