network.hostname: max length of hostname
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues regarding this feature, and didn't find any.
Description
Form the docs: the max length depends on the port (and its tcp/ip stack).
So, without spelunking into each network low-level libraries or make tests on each specific board, we don't know the limit.
Proposal: calling hostname(None) returns the accepted max length of hostname.
Code Size
No response
Implementation
- I intend to implement this feature and would submit a Pull Request if desirable.
network.WIZNET5 : link status; isconnected(): the documentation is incorrect?
Checks
-
I agree to follow the MicroPython Code of Conduct to ensure a safe and respectful space for everyone.
-
I've searched for existing issues regarding this feature, and didn't find any.
Description
On a W5500_EVB_PICO, I see these symbols:
import network
dir(network)
['__class__', '__name__', 'AP_IF', 'STA_IF', 'WIZNET5K', '__dict__', 'country', 'hostname', 'route']
nic = network.WIZNET5K
dir(nic)
['__class__', '__name__', '__bases__', '__dict__', 'active', 'config', 'ifconfig', 'isconnected', 'regs', 'send_ethernet', 'status']
The board is wired to a network switch.
I issue
nic.active(True)
and with Wireshark I see the tcp/ip stack tries to get a lease from a dhcp server.
During this:
nic.isconnected()
False
From the doc
Returns True if the physical Ethernet link is connected and up.
The physical Eth link is running.
Question 1)
is nic.isconnected() not working or is the doc in error?
Polling nic.status(), when it changes from 0 to 2 the nic still isn't configured:
nic.ifconfig()
('0.0.0.0', '0.0.0.0', '0.0.0.0', '0.0.0.0')
I have to poll with nic.isconnected(); when it changes to True the nic has acquired the dhcp lease:
nic.ifconfig()
('192.168.1.2', '255.255.255.0', '192.168.1.1', '9.9.9.9')
Questions:
-
Can you add symbols for the current status() return values ?
-
Can you enhance status() adding the return value STAT_GOT_IP ?
So it is possible to poll just status(), as with WiFi interfaces.
Code Size
No response
Implementation
- I intend to implement this feature and would submit a Pull Request if desirable.
- I hope the MicroPython maintainers or community will implement this feature.
- I would like to Sponsor development of this feature.