← index #11325Issue #4682
Related · high · value 0.478
QUERY · ISSUE

network: status codes/constants not unified across ports

openby msetinaopened 2023-04-24updated 2023-11-10
bug

Working with latest builds (20230422-unstable-v1.19.1-1019) of micropython I found some discrepancies:
ESP32 generic does not have STAT_CONNECT_FAIL in network module.
I noticed that status code value for connecting is 1 in rp2w and 1001 in ESP32.
If we should use constants from documentation then they should be implemented in all ports (please).

Some examples use codes (which is bad) that means they do not work correctly over ports

CANDIDATE · ISSUE

Pyboard D network module station interface: please implement STAT_CONNECTING

openby peterhinchopened 2019-04-08updated 2019-04-12
port-stm32

When calling the station interface connect method there is a need to verify whether the connection succeeded. On ESP8266 and ESP32 this can be done with

while s.status() == network.STAT_CONNECTING:  # Break out on fail or success.
    await asyncio.sleep(1)
if s.isconnected():
    #

Currently the only way seems to be to poll s.isconnected() with an arbitrary timeout.

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied