File tree Expand file tree Collapse file tree 1 file changed +5
-10
lines changed
libraries/SocketWrapper/src Expand file tree Collapse file tree 1 file changed +5
-10
lines changed Original file line number Diff line number Diff line change 66
77arduino::MbedClient::MbedClient ()
88 : _status(false ),
9- _timeout(0 ) {
9+ _timeout(SOCKET_TIMEOUT ) {
1010}
1111
1212uint8_t arduino::MbedClient::status () {
@@ -60,7 +60,6 @@ void arduino::MbedClient::setSocket(Socket *_sock) {
6060}
6161
6262void arduino::MbedClient::configureSocket (Socket *_s) {
63- _s->set_timeout (_timeout);
6463 _s->set_blocking (false );
6564 _s->getpeername (&address);
6665
@@ -213,14 +212,10 @@ size_t arduino::MbedClient::write(const uint8_t *buf, size_t size) {
213212 if (sock == nullptr )
214213 return 0 ;
215214
216- sock->set_blocking (true );
217- sock->set_timeout (SOCKET_TIMEOUT);
218- int ret = NSAPI_ERROR_WOULD_BLOCK;
219- do {
220- ret = sock->send (buf, size);
221- } while ((ret != size && ret == NSAPI_ERROR_WOULD_BLOCK) && connected ());
222- configureSocket (sock);
223- return size;
215+ sock->set_timeout (_timeout);
216+ int ret = sock->send (buf, size);
217+ sock->set_blocking (false );
218+ return ret >= 0 ? ret : 0 ;
224219}
225220
226221int arduino::MbedClient::available () {
You can’t perform that action at this time.
0 commit comments