← index #11450Issue #11545
Likely Duplicate · high · value 0.907
QUERY · ISSUE

network.hostname() seems useless... does mDNS work?

openby massimosalaopened 2023-05-09updated 2024-06-18
bug

Current target: esp8266

On the official docs:
https://docs.micropython.org/en/latest/library/network.html

network.hostname([name])
Get or set the hostname that will identify this device on the network. It is applied to all interfaces.
This hostname is used for:
Sending to the DHCP server in the client request. (If using DHCP)
Broadcasting via mDNS. (If enabled)

It seems to me that there are no references in the esp8266 pages regarding this function:
https://docs.micropython.org/en/latest/esp8266/quickref.html

I tried to use network.hostname() both before and after the wifi initialization (AF_STA mode), but it doesn't seem to work.

With a packet sniffer, enabled in promiscuous mode on the wifi interface, I see the packets (also broadcast and multicast) of other devices but not the packets that esp8266 should send to publish its hostname.

I'm specifically interested in mDNS.

I am available for any test and feedback.

CANDIDATE · ISSUE

docs: network hostname on different ports

closedby massimosalaopened 2023-05-18updated 2023-05-19

It seems on esp8266 this function is useless:

network.hostname()

Please see https://github.com/micropython/micropython/issues/11450

Does anybody confirm this?
If it is unsupported, I think

  1. It has to be documented, ASAP.
  2. It would be nice to fix: remove the function from the ports where it doesn't do anything or leave it but reporting that it doesn't work.

On how to report to the caller of the function, should a NotImplementedError be raised?

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