Skip to content

MDNS requires a dash in hostname? #8238

@ThomasJRyan

Description

@ThomasJRyan

CircuitPython version

Adafruit CircuitPython 8.2.1 on 2023-07-25; Raspberry Pi Pico W with rp2040

Code/REPL

import mdns
import socketpool
import wifi

from adafruit_httpserver import Server, Request, FileResponse


mdns_server = mdns.Server(wifi.radio)
mdns_server.hostname = "helloworld"
mdns_server.advertise_service(service_type="_http", protocol="_tcp", port=80)

pool = socketpool.SocketPool(wifi.radio)
server = Server(pool, "/static", debug=True)

wifi.radio.connect(
                ssid="<redacted>",
                password="<redacted>",
            )

@server.route("/")
def base(request: Request):
    """
    Serve the default index.html file.
    """
    return FileResponse(request, "index.html", "/www")


server.serve_forever(str(wifi.radio.ipv4_address))

Behavior

No error messages.

I am unable to connect to http://helloworld.local

Description

When I set the hostname to something without a dash such as helloworld MDNS does not seem to work correctly and I am unable to connect to http://helloworld.local

However, when I change it to something like hello-world then suddenly I am now able to connect to http://hello-world.local

Additional information

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions