{
If ((packet_len=recv (g_iSkt g_pucRcvPktBuf, g_iTestPktLen, MSG_TRUNC)) & lt;=0)
{
If ((packet_len & lt; 0) & amp; & (errno==EAGAIN | | errno==EWOULDBLOCK | | errno==EINTR))
{
DEBUG_TEST (" -- -- -- -- -- -- -- -- -- -- -- -- packet_len is % d, errno is % d \ n ", packet_len, errno);
Perror (" socket continue ");
continue;
}
Perror (" socket break ");
break;
}
The else
{
//packet processing, check whether the data is correct
}
}
CodePudding user response:
Add a header that contains the data length, when receiving charge baotou first, and then according to the length of the data in baotou to receive the data below,