Skip to content

mdns is not working STA and AP mode #5711

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

Open
sonukushwah221 opened this issue Feb 2, 2019 · 13 comments
Open

mdns is not working STA and AP mode #5711

sonukushwah221 opened this issue Feb 2, 2019 · 13 comments

Comments

@sonukushwah221
Copy link

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.

@codebeat-nl
Copy link

  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.

@d-a-v
Copy link
Collaborator

d-a-v commented Feb 6, 2019

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) ?

@devyte
Copy link
Collaborator

devyte commented Feb 8, 2019

@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.

@LaborEtArs
Copy link
Contributor

LaborEtArs commented Feb 8, 2019

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.

@d-a-v d-a-v removed their assignment Feb 8, 2019
@flav1972
Copy link

flav1972 commented Mar 9, 2019

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

@d-a-v
Copy link
Collaborator

d-a-v commented Jun 25, 2019

Is it possible for you to try PR #6224 ?

@arantius
Copy link

arantius commented Dec 7, 2019

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.

@TD-er
Copy link
Contributor

TD-er commented Dec 7, 2019

Do you call this function after changing the wifi mode?

/* Application should call this whenever AP is configured/disabled */
void notifyAPChange();

@arantius
Copy link

arantius commented Dec 7, 2019

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

@ramiws
Copy link

ramiws commented May 23, 2020

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?

@papadenis
Copy link

papadenis commented Aug 7, 2020

Try this
#2602

@d-a-v
Copy link
Collaborator

d-a-v commented Oct 15, 2020

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

@arantius
Copy link

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

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

No branches or pull requests

10 participants