Unverified Commit e99437c8 authored by rtpmsys's avatar rtpmsys Committed by GitHub

Add missing function getSocketOption (#7807)

* Update WiFiClient.h

Added missing getSocketOption() with full access to level and option

* Update WiFiClient.h

* Handle timeout settings below 1 second

Fix error with connect timeout settings below 1000ms.
Add getsocketoptions function.

* Add cast for setsockopt length

---------
Co-authored-by: default avatarMe No Dev <me-no-dev@users.noreply.github.com>
parent ac1c0012
......@@ -322,6 +322,16 @@ int WiFiClient::setSocketOption(int level, int option, const void* value, size_t
return res;
}
int WiFiClient::getSocketOption(int level, int option, const void* value, size_t size)
{
int res = getsockopt(fd(), level, option, (char *)value, (socklen_t*)&size);
if(res < 0) {
log_e("fail on fd %d, errno: %d, \"%s\"", fd(), errno, strerror(errno));
}
return res;
}
int WiFiClient::setTimeout(uint32_t seconds)
{
Client::setTimeout(seconds * 1000); // This should be here?
......
......@@ -88,6 +88,7 @@ public:
int setSocketOption(int option, char* value, size_t len);
int setSocketOption(int level, int option, const void* value, size_t len);
int getSocketOption(int level, int option, const void* value, size_t size);
int setOption(int option, int *value);
int getOption(int option, int *value);
int setTimeout(uint32_t seconds);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment