Arduino: mdns is not working STA and AP mode

Created on 2 Feb 2019  路  13Comments  路  Source: esp8266/Arduino

Hello

I want to use mDns service with AP and STA mode but it's working fine in the AP mode but it's not working in the STA mode. please share the suggestions and solutions how we can access this mdns in both mode.

network troubleshooting

Most helpful comment

I'm commenting on this open bug after finding at least #2602 and #6290 (already resolved)

  1. Open Examples > ESP8266mDNS > mDNS_Web_Server
  2. Type in SSID/PSK values.
  3. Flash/upload.
  4. mDNS works, device is discovered correctly (from LAN client, via STA address).
  5. Change to WiFi.mode(WIFI_AP_STA); (and change the name so it's clear which version is running, by the mDNS answer).
  6. Flash/upload.
  7. mDNS fails, name never resolves.

I've tested various versions -- 2.3.0 and 2.4.0 definitely work as expected both ways. This lines up with 2.5.0 including an mDNS rewrite. As a workaround for now, I've copied the library from 2.4.2 and I'm depending on that instead of the one bundled with the esp8266 core.

All 13 comments

  1. Wrong question title, at least one mode works as stated in your question;
  2. Are you sure you not confusing both?

You need a bonjour (mDNS) service on the network (STA=Station mode, part of the network) and with AP (Access Point, own network) there is no bonjour service available so that's why it is not working. This is not an error.

There's a possibility where mDNS can be used in AP mode, where a computer running bonjour or avahi is connected. ESP broadcasts/multicasts its mDNS name and the computer's daemon should be able to resolve this name.
We need to check or reproduce that issue.

  • is mDNS broadcasting to 255.255.255.255 or multicasting ?
  • is lwIP sending such broadcast/multicast packets on every up/enabled interfaces (ap & sta) ?

@d-a-v I could be wrong, but I suspect that @sonukushwah221 request is to be able to use mdns in STA_AP mode on both interfaces at the same time. I haven't tested with the @LaborEtArs implementation, but at least the legacy class would work ether in STA mode, or in AP mode, or only on the STA interface when in STA_AP mode when connected to a router, or only on the AP interface when STA was disconnected. It would not work on both interfaces when STA was connected.

Currently LEAmDNS will work in STATION OR AP mode, not in both. If both are activated, the AP netif is used as the multicast interface.
This should be the same behavior as in the legacy mDNS implementation.

For me it is not working in AP mode. When STA or both are enabled it is working.

Is it possible for you to try PR #6224 ?

I'm commenting on this open bug after finding at least #2602 and #6290 (already resolved)

  1. Open Examples > ESP8266mDNS > mDNS_Web_Server
  2. Type in SSID/PSK values.
  3. Flash/upload.
  4. mDNS works, device is discovered correctly (from LAN client, via STA address).
  5. Change to WiFi.mode(WIFI_AP_STA); (and change the name so it's clear which version is running, by the mDNS answer).
  6. Flash/upload.
  7. mDNS fails, name never resolves.

I've tested various versions -- 2.3.0 and 2.4.0 definitely work as expected both ways. This lines up with 2.5.0 including an mDNS rewrite. As a workaround for now, I've copied the library from 2.4.2 and I'm depending on that instead of the one bundled with the esp8266 core.

I'm not "changing" the wifi mode (at run time). I'm changing the source code, recompiling, and re-flashing. Like I wrote above.

So is the one bundled with the esp8266 core still broken? How do I check what version is included now in the core I am running?

Try this

2602

A major update has landed in current git version. mDNS is now interface agnostic. Can you try it ?

2.7.4 seems to work as expected but I'm not prepared to build from source to test that.

Was this page helpful?
0 / 5 - 0 ratings