Network scan is blocking
- pythoncoder
- Posts: 5956
- Joined: Fri Jul 18, 2014 8:01 am
- Location: UK
- Contact:
Network scan is blocking
In my tests on an SF6W a station interface scan (which returns 7 networks here) blocks for ~597ms. This is even worse on the ESP32 where it blocks for 2.5s. It would be good if there were a nonblocking alternative. Or a fast way to check the status of a given SSID.
Peter Hinch
Index to my micropython libraries.
Index to my micropython libraries.
Re: Network scan is blocking
Now that the code is available you can see how scan works. You'll notice it's just doing a busy wait at the end of the scan() method. So in principle it's pretty easy to make it non-blocking, it's just a matter of defining how the user-facing Python API looks.
You can also specify a specific (B)SSID for the scan, but from my tests it doesn't make it much faster.
You can also specify a specific (B)SSID for the scan, but from my tests it doesn't make it much faster.