Closed
Description
CircuitPython version
Adafruit CircuitPython 9.1.0-beta.0 on 2024-03-28; Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM with ESP32S3
vs.
Adafruit CircuitPython 9.1.0-beta.0 on 2024-03-28; Raspberry Pi Pico W with rp2040
Code/REPL
import time
import os
import traceback
import microcontroller
import wifi
import socketpool
import mdns
PORT1 = 8086
PORT2 = 8088
time.sleep(3) # wait for serial
print(f'{os.uname()=}')
print(f'{microcontroller.cpu.reset_reason=}') # is device just coming off a reset?
print(f'{os.getenv("CIRCUITPY_WEB_API_PASSWORD")=}') # check for web workflow
mdns_server = mdns.Server(wifi.radio)
mdns_server.hostname = "slots-code-py"
try:
print(f"http://{mdns_server.hostname}.local.:{PORT1} starting...")
mdns_server.advertise_service(service_type="_fake", protocol="_udp", port=PORT1)
print(f"http://{mdns_server.hostname}.local.:{PORT2} starting...")
mdns_server.advertise_service(service_type="_blah", protocol="_tcp", port=PORT2)
except RuntimeError as ex:
traceback.print_exception(ex, ex, ex.__traceback__)
print("Done.")
Behavior
Fresh reset in each case. Web workflow is not enabled.
espressif
allows (as expected) multiple unique service-protocol-port combinations. raspberrypi
does not.
The only limitation noted in the docs is:
service_type and protocol can only occur on one port. Any call after the first will update the entry’s port.
espressif
output (successful):
os.uname()=(sysname='ESP32S3', nodename='ESP32S3', release='9.1.0', version='9.1.0-beta.0 on 2024-03-28', machine='Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM with ESP32S3')
microcontroller.cpu.reset_reason=microcontroller.ResetReason.SOFTWARE
os.getenv("CIRCUITPY_WEB_API_PASSWORD")=None
http://slots-code-py.local.:8086 starting...
http://slots-code-py.local.:8088 starting...
Done.
raspberrypi
output (unsuccessful):
os.uname()=(sysname='rp2040', nodename='rp2040', release='9.1.0', version='9.1.0-beta.0 on 2024-03-28', machine='Raspberry Pi Pico W with rp2040')
microcontroller.cpu.reset_reason=microcontroller.ResetReason.SOFTWARE
os.getenv("CIRCUITPY_WEB_API_PASSWORD")=None
http://slots-code-py.local.:8086 starting...
http://slots-code-py.local.:8088 starting...
Traceback (most recent call last):
File "code.py", line 32, in <module>
RuntimeError: Out of MDNS service slots
Done.
If web workflow is enabled, results are similar...
espressif
output (successful):
os.uname()=(sysname='ESP32S3', nodename='ESP32S3', release='9.1.0', version='9.1.0-beta.0 on 2024-03-28', machine='Adafruit QT Py ESP32-S3 4MB Flash 2MB PSRAM with ESP32S3')
microcontroller.cpu.reset_reason=microcontroller.ResetReason.SOFTWARE
os.getenv("CIRCUITPY_WEB_API_PASSWORD")=passw0rd
http://slots-code-py.local.:8086 starting...
http://slots-code-pylocal.:8088 starting...
Done.
raspberrypi
output (unsuccessful - fails on the first .advertise_service
):
os.uname()=(sysname='rp2040', nodename='rp2040', release='9.1.0', version='9.1.0-beta.0 on 2024-03-28', machine='Raspberry Pi Pico W with rp2040')
microcontroller.cpu.reset_reason=microcontroller.ResetReason.SOFTWARE
os.getenv("CIRCUITPY_WEB_API_PASSWORD")=passw0rd
http://slots-code-py.local.:8086 starting...
Traceback (most recent call last):
File "code.py", line 20, in <module>
RuntimeError: Out of MDNS service slots
Done.