ESP32 - Arduino - Connecting to a local server
-
- Posts: 3
- Joined: Tue Mar 21, 2017 12:44 pm
ESP32 - Arduino - Connecting to a local server
Hi,
I hope I'm posting this at the correct place, anyhow.
The ESP32 so far has been great using the Arduino IDE.
The Wifi HTTP get example works great, for online server though.
So Google and Example.com work great, the thing is though, I've got a NodeJS server running on a Raspberry Pi.
And I've got both IP and domain name working (pi.local) in my browser, but I can't seem to get the ESP32 to connect to it.
Could any of you help me?
I hope I'm posting this at the correct place, anyhow.
The ESP32 so far has been great using the Arduino IDE.
The Wifi HTTP get example works great, for online server though.
So Google and Example.com work great, the thing is though, I've got a NodeJS server running on a Raspberry Pi.
And I've got both IP and domain name working (pi.local) in my browser, but I can't seem to get the ESP32 to connect to it.
Could any of you help me?
- martinayotte
- Posts: 141
- Joined: Fri Nov 13, 2015 4:27 pm
Re: ESP32 - Arduino - Connecting to a local server
Are you using "pi.local" or it's actual IP address ?
(because mdns doesn't mean you DNS of your network can resolve it)
(because mdns doesn't mean you DNS of your network can resolve it)
-
- Posts: 3
- Joined: Tue Mar 21, 2017 12:44 pm
Re: ESP32 - Arduino - Connecting to a local server
I have actually tried both
- martinayotte
- Posts: 141
- Joined: Fri Nov 13, 2015 4:27 pm
Re: ESP32 - Arduino - Connecting to a local server
I don't see any reason why using IP of this RPi you would have issue connecting to it.
There must be an error in the code, either on ESP side or RPi side.
There must be an error in the code, either on ESP side or RPi side.
Re: ESP32 - Arduino - Connecting to a local server
I think Martin had it spotted earlier. Domain names that are "xxx.local" are "special". Let us assume that you are trying to resolve the domain name a.b.com. Your ESP32 will connect to the DNS server you have defined and will ask it "Please get me the IP address for a.b.com". The DNS server will then return the IP address. All is well.
On your ESP32 if you try and resolve "a.local", exactly the same thing will happen ... your ESP32 will contact the DNS server and ask for the IP address of "a.local" but this time the DNS server will respond with "Sorry ... no idea about that resolution".
The reason it "appears" to work in your browser is that the implementation of the browser looks at the URL/address and explicitly says to itself "Does the domain name end in '.local'?". If it does NOT, then the name is sent to DNS for resolution ... if it DOES end in ".local", then the browser uses mDNS to attempt to look up the IP address of the resolution.
It is likely (opinion) that in your code when you try and resolve a domain name, it is exclusively attempting to go against DNS and the logic (either that which you have written or the library that you are using) isn't coded to examine the domain name for mDNS local names.
On your ESP32 if you try and resolve "a.local", exactly the same thing will happen ... your ESP32 will contact the DNS server and ask for the IP address of "a.local" but this time the DNS server will respond with "Sorry ... no idea about that resolution".
The reason it "appears" to work in your browser is that the implementation of the browser looks at the URL/address and explicitly says to itself "Does the domain name end in '.local'?". If it does NOT, then the name is sent to DNS for resolution ... if it DOES end in ".local", then the browser uses mDNS to attempt to look up the IP address of the resolution.
It is likely (opinion) that in your code when you try and resolve a domain name, it is exclusively attempting to go against DNS and the logic (either that which you have written or the library that you are using) isn't coded to examine the domain name for mDNS local names.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
-
- Posts: 3
- Joined: Tue Mar 21, 2017 12:44 pm
Re: ESP32 - Arduino - Connecting to a local server
Thank you both for your help, it was indeed the library that had trouble with local ip adresses. I now got it working with another one
Re: ESP32 - Arduino - Connecting to a local server
Could you please explain the method to solve the issue?BluesBoyDje wrote:Thank you both for your help, it was indeed the library that had trouble with local ip adresses. I now got it working with another one
Because I've experienced the same issue.
For all esp 32 expert,
I can't browse esp32.local in my web browser.
I'm using this code for my ESP32
https://github.com/espressif/arduino-es ... Server.ino
In my arduino serial monitor only show:
rst:0x10 (RTCWDT_RTC_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0010,len:4
load:0x3fff0014,len:588
load:0x40078000,len:0
load:0x40078000,len:10472
entry 0x40078a28
...
Connected to B520
IP address: 192.168.1.3
mDNS responder started
TCP server started
I'm using windows 7 and have installed bonjour with enable firewall.
Previously I have set my esp32 as server and client with no problem. When I try to set multicastDNS to autodetect my ip of esp32, the problem was occured.
Thank you,
Saaddin
Re: ESP32 - Arduino - Connecting to a local server
I just realize that the error is came from my windows 7. Because I can open the page in my ubuntu and have ping too. Here I attach the relevant screenshot.
Is there any other idea to playing mdns well in windows 7?
Thank you,
Saaddin Nur
Is there any other idea to playing mdns well in windows 7?
Thank you,
Saaddin Nur
- Attachments
-
- esp32 mdns success ubuntu.png (112.11 KiB) Viewed 21902 times
-
- ping success ubuntu.png (306.36 KiB) Viewed 21902 times
Re: ESP32 - Arduino - Connecting to a local server
I have the same problem with ESPmDNS. The example sketch compiled without any error, but the name resolution does not work.
The web server was working and I could access it by IP address in my Firefox browser. But if I used "http://esp32.local" it does not work.
I suppose, some additional parameter (IP address in suitable form) is missing from MDNS.begin("esp32",???...).
How should I bind the IPAddress to the <name>?
Can somebody help me?
The web server was working and I could access it by IP address in my Firefox browser. But if I used "http://esp32.local" it does not work.
I suppose, some additional parameter (IP address in suitable form) is missing from MDNS.begin("esp32",???...).
How should I bind the IPAddress to the <name>?
Can somebody help me?
-
- Posts: 3
- Joined: Sat Aug 03, 2019 8:14 am
Who is online
Users browsing this forum: No registered users and 134 guests