Skip to content

Commit f0cb2a6

Browse files
committed
SocketWrapper lib Client setConnectionTimeout added
and timeout applied for connect
1 parent 2ece915 commit f0cb2a6

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

Diff for: libraries/SocketWrapper/src/AClient.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ void arduino::AClient::setSocket(Socket *sock) {
1818
client->setSocket(sock);
1919
}
2020

21+
void arduino::AClient::setConnectionTimeout(unsigned long timeout) {
22+
setSocketTimeout(timeout);
23+
}
24+
25+
2126
void arduino::AClient::setSocketTimeout(unsigned long timeout) {
2227
if (!client) {
2328
newMbedClient();

Diff for: libraries/SocketWrapper/src/AClient.h

+1
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ class AClient : public Client {
5353

5454
using Print::write;
5555

56+
void setConnectionTimeout(unsigned long timeout);
5657
void setSocketTimeout(unsigned long timeout);
5758

5859
protected:

Diff for: libraries/SocketWrapper/src/MbedClient.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ int arduino::MbedClient::connect(SocketAddress socketAddress) {
100100
if (static_cast<TCPSocket *>(sock)->open(getNetwork()) != NSAPI_ERROR_OK) {
101101
return 0;
102102
}
103-
103+
sock->set_timeout(_timeout);
104104
nsapi_error_t returnCode = static_cast<TCPSocket *>(sock)->connect(socketAddress);
105105
int ret = 0;
106106

0 commit comments

Comments
 (0)