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

Add missing function getSocketOption #7807

Merged
merged 9 commits into from
Nov 29, 2023
10 changes: 10 additions & 0 deletions libraries/WiFi/src/WiFiClient.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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?
Expand Down
1 change: 1 addition & 0 deletions libraries/WiFi/src/WiFiClient.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ class WiFiClient : public ESPLwIPClient

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);
Expand Down