-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Add missing function getsocketoption #7361
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
Conversation
Added missing getSocketOption() with full access to level and option
Update WiFiClient.h
Update WiFiClient.h
Fix error with connect timeout settings below 1000ms. Add getsocketoptions function.
This PR seems to include two non-relevant changes. Could you please split the timeout fix and |
Any updates @rtpmsys? |
Why keep on insisting to have a |
I submitted only the timeout correction and omitted the
I submitted just the timeout change (#7686) which fixes the error with connect timeout values below 1 second. |
You are right that the setTimeout function only expects seconds, I guess for compatibility reasons? The setTimeout luckily only seems to affect the write and read from the socket, not the connect. |
@@ -231,7 +231,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port, int32_t timeout) | |||
FD_ZERO(&fdset); | |||
FD_SET(sockfd, &fdset); | |||
tv.tv_sec = _timeout / 1000; | |||
tv.tv_usec = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved into another PR
I will submit a new PR for adding the missing function getSocketOption. |
WiFimanager.cpp connect function truncated all connnect timeout values below 1000ms to 0ms and rounded timeouts to the full second, e.g. 2.5 seconds became 2 seconds. For timeouts below 1000ms, the connect function failed. This fix handles timeouts correctly, by putting the fractional part of the timeout into the timeout_us variable.
Added function getsocketoptions, it was missing.