Commit 48baa618 by Marcus Winter

mtapi_network_c: bugfix for partial send

parent b6fa354f
...@@ -177,8 +177,17 @@ int embb_mtapi_network_socket_select( ...@@ -177,8 +177,17 @@ int embb_mtapi_network_socket_select(
int embb_mtapi_network_socket_sendbuffer( int embb_mtapi_network_socket_sendbuffer(
embb_mtapi_network_socket_t * that, embb_mtapi_network_socket_t * that,
embb_mtapi_network_buffer_t * buffer) { embb_mtapi_network_buffer_t * buffer) {
int result = send(that->handle, buffer->data, buffer->size, 0); char * buf = (char*)(buffer->data);
if (result == buffer->size) { int cnt = 0;
int result = send(that->handle, buf, buffer->size, 0);
while (result > 0) {
buf += result;
cnt += result;
if (cnt == buffer->size)
break;
result = send(that->handle, buf, buffer->size - cnt, 0);
}
if (cnt == buffer->size) {
return buffer->size; return buffer->size;
} else { } else {
return 0; return 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