UDP Query keeps timing out #9347
-
I keep getting time out thrown, the code used to work over night can anyone suggest a fix
|
Beta Was this translation helpful? Give feedback.
Replies: 6 comments 4 replies
-
It appears that a fresh query is successful only on the fourth attempt and there are things I may have to do to get it working inside async io |
Beta Was this translation helpful? Give feedback.
-
Please tell, which board & MicroPython version you use. Besides that: Are you sure that the server responds? |
Beta Was this translation helpful? Give feedback.
-
Thank you I am running micro python ver 1.19 on Weimos ESp8266, the server is pool.ntp.org or its variant domains like 0.uk.pool.ntp.org, I have tested it in stand alone mode i.e no async nothing just standalone file to avoid confusion with my other application code. The stand alone function code is as below. The server responds - please see log below, the IP address returned by DNS is the same from the second try till it succeeds on the 8th try
|
Beta Was this translation helpful? Give feedback.
-
I had more success with a 10 second timeout. I also put the core of code similar to yours in a while loop that would bail-out after 5 attempts. I still occasionally get a fail. |
Beta Was this translation helpful? Give feedback.
-
With 10 second time out WDT kicks in to restart the device. The following is NON blocking socket i.e time out set to 0
|
Beta Was this translation helpful? Give feedback.
-
Ok, I vaguely remember reading in the docs that asyncio using UDP is flaky or not implemented and has to be handled with polling. The following code works every time on the first attempt
|
Beta Was this translation helpful? Give feedback.
Ok, I vaguely remember reading in the docs that asyncio using UDP is flaky or not implemented and has to be handled with polling.
The following code works every time on the first attempt