Skip to content

Commit 776bb4a

Browse files
committed
MbedClient: make write() more reliable
1 parent d92ac18 commit 776bb4a

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

libraries/SocketWrapper/src/MbedClient.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,10 @@ size_t arduino::MbedClient::write(const uint8_t *buf, size_t size) {
195195

196196
sock->set_blocking(true);
197197
sock->set_timeout(SOCKET_TIMEOUT);
198-
sock->send(buf, size);
198+
int ret = NSAPI_ERROR_WOULD_BLOCK;
199+
do {
200+
ret = sock->send(buf, size);
201+
} while (ret != size && connected());
199202
configureSocket(sock);
200203
return size;
201204
}

0 commit comments

Comments
 (0)