QNEthernet and NativeEthernet staticIP not working with WS Server #39
Comments
Test using RP2040 and RP2040-Ethernet-Client, core arduino-pico, W5500 Ethernet. Both DCHP and StaticIP are OK. So we can narrow down the issue is around this library's QNEthernet / NativeEtnernet implementation or QNEthernet / NativeEtnernet of handling StaticIP 1. RP2040-Ethernet-Client on RASPBERRY_PI_PICO, DHCP
2. RP2040-Ethernet-Client on RASPBERRY_PI_PICO, staticIP
|
Hi @ssilverman I narrow down the bug which is in QNEthernet and NativeEthernet. This happens when we're using Steps to duplicate
then OK
|
More tests on yahoo.com1. ping
2. Using hostname
|
Thanks for the details. I will have a look. |
The error is in function in
with the return value |
What are you setting the IP/netmask/gateway to in the above tests? Also, what are these values when using DHCP? |
They are set according to my local network, and they are certainly correct as they are OK for https://github.com/khoih-prog/QNEthernet/blob/master/examples/WebClient/WebClient.ino#L28-L34
|
I think I figured it out; there appear to be two factors:
|
But why the staticIP is working normally when using server's in the WebClient code, there is already 5000ms timeout waiting for localIP
Moreover, there is no I guess this is very elusive bug, don't know there's anything related to the T4.1 Ethernet chip, because |
OMG, you're right. If I change https://github.com/khoih-prog/QNEthernet/blob/master/examples/WebClient/WebClient.ino#L87 from
to
then it's OK with
|
I just pushed some new commits; I hadn't pushed it yet. :)
5000ms timeout waiting for localIP question: If a static IP is set, then there is immediately a valid localIP; no link is required. WIth DHCP, if it receives an IP address, a link has already been established because otherwise no traffic would come in. |
Can you add something in your lib that Such as in |
Now the WebSockets is working OK with the added
|
I don't want to make functions blocking without a specified timeout. What are your thoughts about Additionally, I'm not a fan of setting some easy-to-forget state that affects the behaviour of other functions. The necessary building blocks are already there and it's my preference to provide the building blocks but not all possible variations of options. The best way to do all this instead, in my opinion, is to use the listener approach and watch for events, and then take actions on those events. The approach where all the state is detected once at the beginning of the program and then never again is brittle. |
I agree with this approach, and this can only be decided by checking some ready events in the QNEthernet library. Certainly it's all up to your decision, which I trust is the good one. Updated: The library can make this not wasting time, much better than anywhere else. |
I will update all the QNEthernet and NativeEthernet-related code for all of my other libraries and publish new releases |
Thanks for your suggestions. I appreciate all your input. Of these three things for a needed task:
Item 1 is the best, but sometimes it would make the API larger than necessary and more unmanageable. Item 2 is the minimum if Item 1 isn't possible, and will happen sometimes. My goal is to avoid Item 3. If something is needed, but the API can't provide for that need, then I agree with adding or modifying so that Items 1 or 2 become possible. Which brings me to my question: even if clunky, do you feel that the QNEthernet API can do everything that you need? |
I prefer 1., certainly with these preferences
Anyway, I spent some time going thru your lib last night, and still think yours is still one of the best libs I've known. I can trust everything you do now. |
Hi @ssilverman The new WebSockets2_Generic releases v1.10.2 has just been published. Your contribution, bug-fixing suggestion is noted in Contributions and Thanks Release v1.10.2
|
### Releases v2.0.2 1. Fix bug when using `QNEthernet` staticIP. Check [QNEthernet and NativeEthernet staticIP not working with WS Server #39](khoih-prog/WebSockets2_Generic#39) 2. Simplify and add staticIP option to `NativeEthernet` examples 3. Add support to SAMD21/SAMD51 boards using [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 4. Add `Packages' Patches` for [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 5. Update `Packages' Patches`
### Releases v2.0.2 1. Fix bug when using `QNEthernet` staticIP. Check [QNEthernet and NativeEthernet staticIP not working with WS Server #39](khoih-prog/WebSockets2_Generic#39) 2. Simplify and add staticIP option to `NativeEthernet` examples 3. Add support to SAMD21/SAMD51 boards using [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 4. Add `Packages' Patches` for [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 5. Update `Packages' Patches`
### Releases v1.7.6 1. Fix bug when using `QNEthernet` staticIP. Check [QNEthernet and NativeEthernet staticIP not working with WS Server #39](khoih-prog/WebSockets2_Generic#39) 2. Simplify and add staticIP option to `NativeEthernet` examples 3. Add support to SAMD21/SAMD51 boards using [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 4. Add `Packages' Patches` for [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 5. Update `Packages' Patches`
### Releases v1.7.6 1. Fix bug when using `QNEthernet` staticIP. Check [QNEthernet and NativeEthernet staticIP not working with WS Server #39](khoih-prog/WebSockets2_Generic#39) 2. Simplify and add staticIP option to `NativeEthernet` examples 3. Add support to SAMD21/SAMD51 boards using [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 4. Add `Packages' Patches` for [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 5. Update `Packages' Patches`
### Releases v1.7.6 1. Fix bug when using `QNEthernet` staticIP. Check [QNEthernet and NativeEthernet staticIP not working with WS Server #39](khoih-prog/WebSockets2_Generic#39) 2. Simplify and add staticIP option to `NativeEthernet` examples. 3. Add support to SAMD21/SAMD51 boards using [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 4. Add `Packages' Patches` for [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 5. Update `Packages' Patches`
### Releases v1.7.6 1. Fix bug when using `QNEthernet` staticIP. Check [QNEthernet and NativeEthernet staticIP not working with WS Server #39](khoih-prog/WebSockets2_Generic#39) 2. Simplify and add staticIP option to `NativeEthernet` examples. 3. Add support to SAMD21/SAMD51 boards using [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 4. Add `Packages' Patches` for [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 5. Update `Packages' Patches`
### Releases v1.7.6 1. Fix bug when using `QNEthernet` staticIP. Check [QNEthernet and NativeEthernet staticIP not working with WS Server #39](khoih-prog/WebSockets2_Generic#39) 2. Simplify and add staticIP option to `NativeEthernet` examples. 3. Add support to SAMD21/SAMD51 boards using [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 4. Add `Packages' Patches` for [Fab_SAM_Arduino core](https://github.com/qbolsee/ArduinoCore-fab-sam) 5. Update `Packages' Patches`
The original issue was reported in PJRC forum in WebSockets_Generic Library
Duplicated here for easier to follow-up.
The text was updated successfully, but these errors were encountered: