ESP32 - Arduino - Connecting to a local server

BluesBoyDje
Posts: 3
Joined: Tue Mar 21, 2017 12:44 pm

ESP32 - Arduino - Connecting to a local server

Postby BluesBoyDje » Tue Mar 21, 2017 12:51 pm

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

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

Re: ESP32 - Arduino - Connecting to a local server

Postby martinayotte » Wed Mar 22, 2017 6:52 pm

Are you using "pi.local" or it's actual IP address ?
(because mdns doesn't mean you DNS of your network can resolve it)

BluesBoyDje
Posts: 3
Joined: Tue Mar 21, 2017 12:44 pm

Re: ESP32 - Arduino - Connecting to a local server

Postby BluesBoyDje » Wed Mar 22, 2017 7:57 pm

I have actually tried both

User avatar
martinayotte
Posts: 141
Joined: Fri Nov 13, 2015 4:27 pm

Re: ESP32 - Arduino - Connecting to a local server

Postby martinayotte » Thu Mar 23, 2017 2:23 pm

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.

User avatar
kolban
Posts: 1683
Joined: Mon Nov 16, 2015 4:43 pm
Location: Texas, USA

Re: ESP32 - Arduino - Connecting to a local server

Postby kolban » Thu Mar 23, 2017 2:58 pm

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.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32

BluesBoyDje
Posts: 3
Joined: Tue Mar 21, 2017 12:44 pm

Re: ESP32 - Arduino - Connecting to a local server

Postby BluesBoyDje » Fri Mar 24, 2017 4:49 pm

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

niddaas
Posts: 2
Joined: Sat Aug 19, 2017 11:27 pm

Re: ESP32 - Arduino - Connecting to a local server

Postby niddaas » Sat Aug 19, 2017 11:36 pm

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 :)
Could you please explain the method to solve the issue?
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

niddaas
Posts: 2
Joined: Sat Aug 19, 2017 11:27 pm

Re: ESP32 - Arduino - Connecting to a local server

Postby niddaas » Sun Aug 20, 2017 12:11 am

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
Attachments
esp32 mdns success ubuntu.png
esp32 mdns success ubuntu.png (112.11 KiB) Viewed 21896 times
ping success ubuntu.png
ping success ubuntu.png (306.36 KiB) Viewed 21896 times

ZsLaci
Posts: 1
Joined: Tue Jan 30, 2018 9:29 pm

Re: ESP32 - Arduino - Connecting to a local server

Postby ZsLaci » Wed Jan 31, 2018 9:13 pm

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?

rsssrinivas
Posts: 3
Joined: Sat Aug 03, 2019 8:14 am

Re: ESP32 - Arduino - Connecting to a local server

Postby rsssrinivas » Sun Aug 04, 2019 3:04 am

niddaas wrote:
Sat Aug 19, 2017 11:36 pm
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 :)
pls tell me how did you slove the issue

Who is online

Users browsing this forum: No registered users and 124 guests