Skip to content

Commit

Permalink
docs/library/network: Clarify network.hostname() behaviour.
Browse files Browse the repository at this point in the history
This must be called before the interface connects.

This work was funded through GitHub Sponsors.

Signed-off-by: Jim Mussared <jim.mussared@gmail.com>
  • Loading branch information
jimmo authored and dpgeorge committed Sep 4, 2023
1 parent d001054 commit 304f13a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/library/network.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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])
Expand Down

0 comments on commit 304f13a

Please sign in to comment.