Skip to content

mDNS doesn't work on an Access Point on raspberrypi #9813

@riancz

Description

@riancz

Device: Raspberry Pi Pico W

mDNS seems to not work when combining the two basic examples from the project: Manual AP & mDNS.

I can reach the page when going directly to my ip address on port 5000, however when trying to reach it on abcd.local:8080 it doesn't do anything.

import wifi
import socketpool
from adafruit_httpserver import Server, Request, Response, FileResponse
import mdns

# Set up access point
print("Creating access point...")
wifi.radio.start_ap(ssid="MyNetwork", password="SomePassword!")
print(f"Created access point {SSID}")

#Set up mDNS
mdns_server = mdns.Server(wifi.radio)
mdns_server.hostname = "abcd"
print("MDNS Hostname: " + mdns_server.hostname)
mdns_server.advertise_service(service_type="_http", protocol="_tcp", port=8080)

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

@server.route("/", methods=['GET'])
def index(request):
    """ Render the Index page"""
    if request.method == 'GET':
        return FileResponse(request, "index.html", "/static")


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

settings.toml file is deleted.

Did I do something wrong, or is it some bug?
Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy