Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SocketWrapper lib Client setConnectionTimeout added #915

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions libraries/SocketWrapper/src/AClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
1 change: 1 addition & 0 deletions libraries/SocketWrapper/src/AClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ class AClient : public Client {

using Print::write;

void setConnectionTimeout(unsigned long timeout);
void setSocketTimeout(unsigned long timeout);

protected:
Expand Down
2 changes: 1 addition & 1 deletion libraries/SocketWrapper/src/MbedClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ int arduino::MbedClient::connect(SocketAddress socketAddress) {
if (static_cast<TCPSocket *>(sock)->open(getNetwork()) != NSAPI_ERROR_OK) {
return 0;
}

sock->set_timeout(_timeout);
nsapi_error_t returnCode = static_cast<TCPSocket *>(sock)->connect(socketAddress);
int ret = 0;

Expand Down
Loading