diff --git a/libraries/SocketWrapper/src/AClient.cpp b/libraries/SocketWrapper/src/AClient.cpp index 272b18946..ed1edd7e1 100644 --- a/libraries/SocketWrapper/src/AClient.cpp +++ b/libraries/SocketWrapper/src/AClient.cpp @@ -18,6 +18,11 @@ void arduino::AClient::setSocket(Socket *sock) { client->setSocket(sock); } +void arduino::AClient::setConnectionTimeout(unsigned long timeout) { + setSocketTimeout(timeout); +} + + void arduino::AClient::setSocketTimeout(unsigned long timeout) { if (!client) { newMbedClient(); diff --git a/libraries/SocketWrapper/src/AClient.h b/libraries/SocketWrapper/src/AClient.h index 195f7a1f2..5de75ddd3 100644 --- a/libraries/SocketWrapper/src/AClient.h +++ b/libraries/SocketWrapper/src/AClient.h @@ -53,6 +53,7 @@ class AClient : public Client { using Print::write; + void setConnectionTimeout(unsigned long timeout); void setSocketTimeout(unsigned long timeout); protected: diff --git a/libraries/SocketWrapper/src/MbedClient.cpp b/libraries/SocketWrapper/src/MbedClient.cpp index ad74db1ca..0ae5dd1ca 100644 --- a/libraries/SocketWrapper/src/MbedClient.cpp +++ b/libraries/SocketWrapper/src/MbedClient.cpp @@ -100,7 +100,7 @@ int arduino::MbedClient::connect(SocketAddress socketAddress) { if (static_cast(sock)->open(getNetwork()) != NSAPI_ERROR_OK) { return 0; } - + sock->set_timeout(_timeout); nsapi_error_t returnCode = static_cast(sock)->connect(socketAddress); int ret = 0;