Commit 91ca4a2d by Marcus Winter

mtapi_network_c: bugfix for partial recv

parent 2a8b92ad
......@@ -207,7 +207,18 @@ int embb_mtapi_network_socket_recvbuffer_sized(
return 0;
*/
if (0 < size) {
err = recv(that->handle, buffer->data, size, 0);
char * buf = (char*)(buffer->data);
int cnt = 0;
err = recv(that->handle, buf, size, 0);
while (err > 0) {
cnt += err;
if (cnt == size)
break;
buf += err;
err = recv(that->handle, buf + cnt, size - cnt, 0);
}
if (err > 0)
err = cnt;
} else {
err = 0;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment