Because data isn't sent all on one packet, it can be received in parts. I tried writing a function to fix this problem, but it doesn't work. Anyone know how to do this?
Code:
int GetFullRecv(CHAR *cMsg)
{
char *tok;
tok = strtok(cMsg, "~");
if (tok == NULL)
{
if (strlen(cMsg) > 0)
strcat(recvbuff, cMsg);
return 0;
}
while (tok != NULL)
{
strcat(recvbuff, tok);
ZeroMemory(tmpbuff, 350);
strcat(tmpbuff, "RECV: ");
strcat(tmpbuff, recvbuff);
DispStatus(tmpbuff);
ZeroMemory(recvbuff, 300);
ZeroMemory(tmpbuff, 350);
tok = strtok(NULL, "~");
}
if (strlen(cMsg) > 0)
strcat(recvbuff, cMsg);
return 0;
}