Skip to content

Networking docs updates: Access Point, MDNS #8165

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
Jul 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/workflows.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,10 @@ MDNS is used to resolve [`circuitpython.local`](http://circuitpython.local) to a
hostname of the form `cpy-XXXXXX.local`. The `XXXXXX` is based on network MAC address. The device
also provides the MDNS service with service type `_circuitpython` and protocol `_tcp`.

Since port 80 (or the port assigned to `CIRCUITPY_WEB_API_PORT`) is used for web workflow, the `mdns`
[module](https://docs.circuitpython.org/en/latest/shared-bindings/mdns/index.html#mdns.Server.advertise_service)
can't advertise an additional service on that port.

### HTTP
The web server is HTTP 1.1 and may use chunked responses so that it doesn't need to precompute
content length.
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/mdns/Server.c
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,8 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_KW(mdns_server_find_obj, 1, _mdns_server_find);
//| ``service_type`` and ``protocol`` can only occur on one port. Any call after the first
//| will update the entry's port.
//|
//| If web workflow is active, the port it uses can't also be used to advertise a service.
//|
//| :param str service_type: The service type such as "_http"
//| :param str protocol: The service protocol such as "_tcp"
//| :param int port: The port used by the service"""
Expand Down
14 changes: 12 additions & 2 deletions shared-bindings/wifi/Radio.c
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,12 @@ MP_DEFINE_CONST_FUN_OBJ_1(wifi_radio_stop_station_obj, wifi_radio_stop_station);
//| or exactly 64 hexadecimal characters if it is the hex form of the 256-bit key.
//|
//| If ``max_connections`` is given, the access point will allow up to
//| that number of stations to connect."""
//| that number of stations to connect.
//|
//| .. note::
//|
//| In the raspberrypi port (RP2040 CYW43), ``max_connections`` is ignored.
//| """
//| ...
STATIC mp_obj_t wifi_radio_start_ap(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ssid, ARG_password, ARG_channel, ARG_authmode, ARG_max_connections };
Expand Down Expand Up @@ -559,7 +564,12 @@ MP_PROPERTY_GETTER(wifi_radio_ipv4_subnet_ap_obj,
//| ipv4_dns: Optional[ipaddress.IPv4Address],
//| ) -> None:
//| """Sets the IP v4 address of the station. Must include the netmask and gateway. DNS address is optional.
//| Setting the address manually will stop the DHCP client."""
//| Setting the address manually will stop the DHCP client.
//|
//| .. note::
//|
//| In the raspberrypi port (RP2040 CYW43), the access point needs to be started before the IP v4 address can be set.
//| """
//| ...
STATIC mp_obj_t wifi_radio_set_ipv4_address(size_t n_args, const mp_obj_t *pos_args, mp_map_t *kw_args) {
enum { ARG_ipv4, ARG_netmask, ARG_gateway, ARG_ipv4_dns };
Expand Down