diff options
author | Jim Mussared <jim.mussared@gmail.com> | 2023-09-04 12:50:59 +1000 |
---|---|---|
committer | Damien George <damien@micropython.org> | 2023-09-04 22:45:37 +1000 |
commit | 304f13a74ee5909321a67cf538d3a50d85de1e82 (patch) | |
tree | 07fc8f81ae32e83f672f6b1dc147bca165c28160 /docs/library | |
parent | d00105494fda537b42a73843260920bba8eb1bb8 (diff) |
docs/library/network: Clarify network.hostname() behaviour.
This must be called before the interface connects.
This work was funded through GitHub Sponsors.
Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
Diffstat (limited to 'docs/library')
-rw-r--r-- | docs/library/network.rst | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/docs/library/network.rst b/docs/library/network.rst index b13c84123..a14d6192e 100644 --- a/docs/library/network.rst +++ b/docs/library/network.rst @@ -171,8 +171,8 @@ The following are functions available in the network module. .. function:: hostname([name]) - Get or set the hostname that will identify this device on the network. It is - applied to all interfaces. + Get or set the hostname that will identify this device on the network. It will + be used by all interfaces. This hostname is used for: * Sending to the DHCP server in the client request. (If using DHCP) @@ -182,6 +182,12 @@ The following are functions available in the network module. If the function is called without parameters, it returns the current hostname. + A change in hostname is typically only applied during connection. For DHCP + this is because the hostname is part of the DHCP client request, and the + implementation of mDNS in most ports only initialises the hostname once + during connection. For this reason, you must set the hostname before + activating/connecting your network interfaces. + The default hostname is typically the name of the board. .. function:: phy_mode([mode]) |