use TCP in main thread, accumulate bytes until size matches.

This commit is contained in:
Erwin Coumans
2017-02-20 18:54:12 -08:00
parent 3d73a9d788
commit 942015df9d
3 changed files with 194 additions and 413 deletions

View File

@@ -28,10 +28,12 @@ int main(int argc, char **argv)
{
//printf("try receive\n");
bool receivedData = false;
if (pClient->Receive(MAX_PACKET))
int recBytes = 0;
recBytes = pClient->Receive(MAX_PACKET);
if (recBytes)
{
char* msg = (char*) pClient->GetData();
msg[recBytes]=0;
printf("received message [%s]\n",msg);
//------------------------------------------------------------------
// Send response to client and close connection to the client.