Not getting an error if static IP i gave was not allocated to device #8253
Unanswered
arihantdaga
asked this question in
Q&A
Replies: 1 comment 1 reply
-
this is how TCP/IP network works. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I am making a low power sensor device and connecting to the internet quickly is a must for the device. I am using static IP config to speed up the connection, (it helps by reducing 2 seconds in my case). I plan to deploy multiple devices with different routers. I am doing it this way, on first connection the device would connect using dhcp and then store the IP, Gateway, subnet etc in non volatile storage. On subsequent connection, it can use this saved data.
However if the device is waking up later, that IP may be allocated to another device and device would not get this IP.
But on esp side, i am not able to detect this failure of allocation of IP, instead i get connection successful, but later the device does not connect with router. Is there any method/way to check whether we have an issue with IP address, so that we can retry using DHCP.
My sketch -
https://gist.github.com/arihantdaga/68b78139ed403a6082c178898a3d6209
I expected that if i give an IP out of the range of subnet it would throw error in connection. But it's not.
Is there any way to detect this ?
Beta Was this translation helpful? Give feedback.
All reactions