You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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
The text was updated successfully, but these errors were encountered:
I cannot test right now, but if this is the exact code you are using, then the http server port does not match the mDNS port, which I believe might be the problem here.
You sould set both http and mdns to the same port.
It doesn't work even if the mDNS port is set to 5000 as well. mdns_server.advertise_service(service_type="_http", protocol="_tcp", port=5000)
Also just to be sure I tries to set up both to port 80, with no success. mdns_server.advertise_service(service_type="_http", protocol="_tcp", port=80) server.serve_forever(str(wifi.radio.ipv4_address_ap), port=80)
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.
settings.toml file is deleted.
Did I do something wrong, or is it some bug?
Thanks
The text was updated successfully, but these errors were encountered: