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>
This commit is contained in:
Jim Mussared 2023-09-04 12:50:59 +10:00 committed by Damien George
parent d00105494f
commit 304f13a74e
1 changed files with 8 additions and 2 deletions

View File

@ -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])