-
Notifications
You must be signed in to change notification settings - Fork 105
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
WiFiClient connect timeout #252
base: 2.x.x
Are you sure you want to change the base?
WiFiClient connect timeout #252
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
0114f39
to
4aa71f6
Compare
Memory usage change @ 4aa71f6
Click for full report table
Click for full report CSV
|
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.
Hi @JAndrassy Thanks for your contribution. I may have found a small bug, please take a look at my suggestion.
I think we should add the timeout parameter also to :
void ServerDrv::startClient(uint32_t ipAddress, uint16_t port, uint8_t sock, uint8_t protMode)
SpiDrv::sendParam((uint8_t*)host, host_len); | ||
SpiDrv::sendParam((uint8_t*)&ipAddress, sizeof(ipAddress)); | ||
SpiDrv::sendParam(port); | ||
SpiDrv::sendParam(&sock, 1); | ||
SpiDrv::sendParam(&protMode, 1, LAST_PARAM); | ||
SpiDrv::sendParam(&protMode, 1); | ||
SpiDrv::sendParam(timeout, LAST_PARAM); | ||
|
||
// pad to multiple of 4 | ||
int commandSize = 17 + host_len; |
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.
int commandSize = 17 + host_len; | |
int commandSize = 19 + host_len; |
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.
I don't understand that padding and why it has 'readChar'.
the SPI read padding is unnecessary with nina-fw. the library inherited it from the old WiFi library code.
the 17 is not right even without the timeout parameter. it should be maybe 20 and with timeout added 23 (1 byte param size + 2 bytes param value).
Following the support in the firmware in arduino/nina-fw#89, here is the implementation of WiFiClient.connect timeout.
Additionally the strange 10 seconds waiting time is removed.
overview of Client API in Arduino networking libraries:
https://github.com/JAndrassy/Arduino-Networking-API/blob/main/ArduinoNetAPILibs.md#client-getters-and-setters