result = send(socketTCP, (const char*)(char*)(sByte+offset), size, 0);
if (result < 0){
DWORD a = GetLastError();
ResumeThread(recvThread);
return result;
}
Sleep(100);
//等待服务器响应
int loop = 0;
char bufRecv[MAX_PACKET];
char tempBuf[4096];
int flag = recv(socketTCP, bufRecv, MAX_PACKET, 0);
int temp12 = strlen(bufRecv);
for (int i = 0; i<MAX_PACKET; i++){
tempBuf[i] = bufRecv[i];
}
while (temp12>MAX_PACKET){
loop++;
flag = recv(socketTCP, bufRecv, MAX_PACKET, 0);
//temp12 = strlen(bufRecv) - MAX_PACKET*loop;
temp12 = strlen(bufRecv);
for (int i = 0; i < flag; i++){
tempBuf[i + MAX_PACKET*loop] = bufRecv[i];
}
}
if (flag <= 0){
int temp1 = WSAGetLastError();
printf("receive data error");
return -1;
}
//backData = (unsigned char*)tempBuf;
string backStr = "recv data from server ";
backStr += tempBuf;
//backData = new unsigned char[3036];
int i = 0;
for (i = 0; i < backStr.length(); i++){
backData[i] = backStr[i];
}
backData[i] = '\0';
index = findIndexNum(backData);
//backData = (unsigned char*)backStr.c_str();
//printf("recv data from server:%s", bufRecv);
printf("recv data from server:%s", backData);