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
mDNS doesn't work for AP when in WIFI_AP_STA mode #2602
Comments
I did some further experimenting: I configured the ESP to use a static IP configuration that fits to my subnet-configuration at home now: IPAddress stationLocalIp(192, 168, 2, 2);
IPAddress stationGatewayIp(192, 168, 0, 1);
IPAddress stationSubnetMask(255, 255, 0, 0);
WiFi.config(stationLocalIp, stationGatewayIp, stationSubnetMask); And set the local IP on the AP-network to the same IP: IPAddress apLocalIp(192, 168, 2, 2);
IPAddress apGatewayIp(192, 168, 2, 2);
IPAddress apSubnetMask(255, 255, 255, 0);
WiFi.softAPConfig(apLocalIp, apLocalIp, apSubnetMask); I've done this with the intention to circumvent the need of hostnames and simply use the static ip 192.168.2.2 to reach the ESP in both networks. Now I tried to reach the ESP using the hostnames just for fun again and now the PC (in the home network) cannot resolve the hostname anymore BUT now the iphone (connected to the AP of the ESP) can. That's really strange... :D |
I have exactly the same issue, slightly different circumstances. |
The problem is a bit more complex :) Since we are talking about mDNS, we are talking about multicast service and multicast services are attached to given IP on given interface (AP or STA), I'm not positive that AP interface supports multicast but I will check. Regardless, if you change the configuration, mDNS will not attach to the new interface and it will not work. Maybe try restarting the service. |
Hi me-no-dev, Thanks for the quick reply. I've listed out below the sequence I follow for the case where the config file is present in SPIFFs but the target WiFi is turned off. So the sequence is;
In every occasion, only when WiFi.mode(WIFI_AP) is used will MDNS.begin(host) return true. Forgive me if I have misinterpreted your reply, but do you advocate the following sequence; WiFi.softAP((const char *)ap_network_ssid, (const char *)ap_network_password); Best Regards SteveQuinn1 CODE SEGMENT BELOW;In Setup In Loop MQTTclient.setServer((const char *)mqtt_broker_ip, mqtt_broker_port); if (MDNS.begin(host)) { |
aah :) you are starting the services without waiting for WiFi to connect and assign IP :) WiFi.begin(STA_SSID, STA_PASS);
if(WiFi.waitForConnectResult() != WL_CONNECTED){
Serial.println("WiFi FAIL!!!");
return;
} |
Hi me-no-dev, Ok, I think I know the question I need to ask. I only require mDNS support on the AP side of the ESP8266, consequently is it possible to force/configure the mDNS server in the ESP8266 to bind only with the IP address of the AP when WiFi.mode() has been configured for either WIFI_AP or WIFI_AP_STA? In other words I do not want the mDNS service for the STA n/w connection. In this case it's only required for the AP side as it isn't possible to determine the AP IP address (ok, I know in all the literature, blog posts I've seen in respect of this issue they always indicate the ESP8266 AP IP address seems to default to 192.168.4.1), and wanted to use something along the lines of 'SENSOR.local' in my browser URL once connected to the AP only. Best Regards SteveQuinn1 |
#2864 should solve this issue. |
Thanks for the heads up, Being new to github, how does one pick up the changes? Best Regards SteveQuinn1 |
@SteveQuinn1 you can get the code from https://github.com/swarren/esp8266-arduino/tree/mdns-multi-interface then you'll have to install the "git version" of the ESP8266 support libraries; the instructions to do this are in the README.md file of either the main project or my fork. Either that, or hopefully the patch will get applied soon and included in the next release, which you can obtain using the Arduino IDE board manager. |
Hi Stephen,
Thank you for the quick reply.
The code I wrote which uses the mDNS functionality was for an instructable.
Given the general maker level experience of the site's users I think the best option would be to wait for the patch to be applied, then as you mention it'll just appear via an update of the boards manager. I've stuck a watch on #2864 so will get an update as things progress.
Thank you for your help.
Best Regards
Steve
… On 16 Jan 2017, at 05:37, Stephen Warren ***@***.***> wrote:
@SteveQuinn1 you can get the code from https://github.com/swarren/esp8266-arduino/tree/mdns-multi-interface then you'll have to install the "git version" of the ESP8266 support libraries; the instructions to do this are in the README.md file of either the main project or my fork. Either that, or hopefully the patch will get applied soon and included in the next release, which you can obtain using the Arduino IDE board manager.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
BTW, it's merged now. |
Very cool! Will try this the next time I've the ESP running. |
Relevant code is merged => closing. |
Hi , I'm facing an similar issue. i tried the example ->esp8266mDNS->mDNS_Webserver. I noticed that i'm able to find mDNS (http://esp8266.local) response on only LINUX and Mac OS. Neither my windows PC or my android seems to find this mDNS name."http://esp8266.local ". ONLY when IP address is assigned (say : 192.168.0.10 ) I am able to connect to the esp web server through my android phone and windows PC. I even tried "ping esp8266.local" using run as administrator in windows but no respond. can any one help me connect to server hosted in esp module using mDSN name through android devide and windows. The example code used:
|
Android doesn't support mDNS at all. There are a few 3rd-party applications that implement mDNS queries, although they don't allow *.local names to work in other applications. An application that I've used is "Pea Finder". IIRC, (some versions of?) Windows don't/doesn't natively support mDNS either. You may need to install Apple's Bonjour software for this to work. |
I am trying to add mDNS support to my project. I can get the ESP8266 to report to my Mac once but if you leave it foe a few minutes and try again the ESP will not respond again unless you reset it. I am using the same code as the Sming example UdpServer_mDNS which also exhibits the same behaviour. |
Hi all, I am having the same problem, the mDNS service is announced, but after some minutes disappears, and there is no way to announce the service again until I reset the device. I tried first with the AT command for MDNS, and then programming directly to the ESP8266 and in both cases, with all code combinations I have tried, the behavior is the same. Anyone here has been able to announce services when the device is on without disappearing? Thanks! |
Has this issue really been resolved? I still having and I just installed the 2.5.0-beta3 version of esp8266. I'm using a NodeMCU board. Thanks! /Aram |
Try this, it worked for me. Tested on pair of two ESPs: client and server. Server's part:
Client's part:
|
Basic Infos
Hardware
Hardware: ESP-12F
Core Version: 2.3.0 (From board-manager of Arduino IDE)
Description
Hi,
I'm running the ESP-12F in AP+Station mode, host a webserver on it and try to register a mDNS-Service to access the webserver using
dslr-remote.local
on both interfaces.That way the ESP is connected to my home network and hosts an own wifi-network at the same time.
Station-IP: 192.168.3.33
AP-IP: 192.168.50.1
Access from computer via home network (through the station interface):
http://192.168.3.33 -> Works!
http://dslr-remote.local -> Works!
Access from iPhone connected to the AP of the ESP:
http://192.168.50.1 -> Works!
http://dslr-remote.local -> Cannot resolve address
I also tried to run
MDNS.begin()
twice for the IP-Addresses of both interfaces, but that didn't change anything.After that I set the WIFI_AP mode instead, commented the whole station-related code out and tried again:
Access from iPhone connected to the AP of the ESP:
http://192.168.50.1 -> Works!
http://dslr-remote.local -> Works!
Is there any way to make mDNS working for the AP interface while in WIFI_AP_STA mode?
Is there anything wrong with my code or is that a bug..?
Settings in IDE
Module: Generic ESP8266 Module
Flash Size: 4M (3M SPIFFS)
CPU Frequency: 80Mhz
Flash Mode: DIO
Flash Frequency: 40Mhz
Upload Using: OTA & SERIAL
Reset Method: ck
The text was updated successfully, but these errors were encountered: