From f0cb2a6489179911ab2c2294a8eb8338b73999d1 Mon Sep 17 00:00:00 2001 From: Juraj Andrassy Date: Mon, 1 Jul 2024 07:08:00 +0200 Subject: [PATCH] SocketWrapper lib Client setConnectionTimeout added and timeout applied for connect --- libraries/SocketWrapper/src/AClient.cpp | 5 +++++ libraries/SocketWrapper/src/AClient.h | 1 + libraries/SocketWrapper/src/MbedClient.cpp | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) 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; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy