diff options
author | Erwin Coumans <erwin.coumans@gmail.com> | 2017-02-20 18:54:12 -0800 |
---|---|---|
committer | Erwin Coumans <erwin.coumans@gmail.com> | 2017-02-20 18:54:12 -0800 |
commit | 942015df9dcc208d1a77280bc78fe697a7b550ac (patch) | |
tree | 6fc903316774af1448e6e64cdae1b166c36a3fda /test/clsocket | |
parent | 3d73a9d788c462a6e7c4c87e38d9b9861782f474 (diff) | |
download | bullet3-942015df9dcc208d1a77280bc78fe697a7b550ac.tar.gz |
use TCP in main thread, accumulate bytes until size matches.
Diffstat (limited to 'test/clsocket')
-rw-r--r-- | test/clsocket/EchoServer.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/test/clsocket/EchoServer.cpp b/test/clsocket/EchoServer.cpp index 74c03ac7c..4388fc2f2 100644 --- a/test/clsocket/EchoServer.cpp +++ b/test/clsocket/EchoServer.cpp @@ -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. |