Skip to content
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

Advertising mDNS service #6

Open
DavidM42 opened this issue Jan 24, 2019 · 5 comments
Open

Advertising mDNS service #6

DavidM42 opened this issue Jan 24, 2019 · 5 comments

Comments

@DavidM42
Copy link

DavidM42 commented Jan 24, 2019

Is it possible to advertise the ESP-8266 as mDNS service with this library? There is nothing in the README but I saw the advertise_hostname method.
Tried it but could not get my device to be scanned by avahi. Am I doing wrong or is it not supported?
After connecting to the wifi I tried it with

from httpModules.slimDNS import SlimDNSServer, test
import network
sta_if = network.WLAN(network.STA_IF)
local_addr = sta_if.ifconfig()[0]
server = SlimDNSServer(local_addr, "espname")
response = server.advertise_hostname("servicename")

while (True):
    read_sockets = [server.sock]
    r = list(read_sockets)
    if server.sock in r:
        server.process_waiting_packets()

but I can't discover the ESP

@cartufer
Copy link

I may or may not be having the same issue, i am running on esp32, in a thread. I have debug print messages showing that it is getting the packets and is attempting a reply packet, but my windows 10 with bonjour is not able to ping it with mdns but is with just the ipv4.

@nickovs
Copy link
Owner

nickovs commented Mar 28, 2019

Sorry you are having trouble. This should work fine on both the ESP32 and the ESP8266 and I have both running fine on my network. Can you tell me what versions of Micropython you are running? The support for multicast in the network module has varied over the last year. Also, @cartufer, can you post the code you are using?

@cartufer
Copy link

My code is in https://github.com/cartufer/naiot the slimdns script i think is unmodified, apart from uncommenting some debug printouts. I use testThread() in main.py to launch slimdns. I am running "MicroPython v1.10 on 2019-01-25; ESP32 module with ESP32". Attached is a screenshot of both terminals. Let me know if i can help with testing, i am not advanced in python but i'm willing to run tests.
slimdns_capture

@cartufer
Copy link

I'm not sure if its a socket problem, it may be but i'm starting to think its how packets are being handled. I reverted my esp32 to 1.9.4 and connected to my network. It is still behaving as before, i suspect certain computers/network environments don't take kindly to as you put it in slimDNS.py "We fake the handling of unicast replies.". I don't really have this kind of expertise though and if its working for you then it may be hard to debug on your end. I'm just going to have to find a workaround for referencing my devices.

@stoefln
Copy link

stoefln commented Jan 6, 2020

Does not work on my ESP8266 nodemcu board either :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants