-->
Page 1 of 3

ESP8266 WiFIWebServer get IP and MAC ADDRESS of the client.

PostPosted: Mon Feb 22, 2016 9:01 am
by 01matrix01
Hi all,
I'm starting with ESP8266 a simple project based on ESP8266 WiFiWebServer example, to connect my ESP to my HOME WIFI and it works fine, but now I need a way to get IP and MAC Address of the client that ask the ESP for a web page.

I found a solution but it works only if I make the ESP as AP STATION, so I can query *stat_info to get information on all clients connected.

Any solution for simple ESP client?

Thanks in advance.

Re: ESP8266 WiFIWebServer get IP and MAC ADDRESS of the clie

PostPosted: Sun Mar 13, 2016 11:02 am
by anotherjoe
Getting the IP address of the calling client seems to be easy enough:
Code: Select allwebserver->client().remoteIP().toString()

where webserver is a:
Code: Select allESP8266WebServer* webserver;


The MAC address looks to be a bit more challenging though - I don't see any available method in the arduino core that enables this. Perhaps there's something in the underlying SDK..not sure.

Re: ESP8266 WiFIWebServer get IP and MAC ADDRESS of the clie

PostPosted: Sun Mar 13, 2016 12:49 pm
by gcarmich
WiFi.macAddress()

Re: ESP8266 WiFIWebServer get IP and MAC ADDRESS of the clie

PostPosted: Sun Mar 13, 2016 1:31 pm
by martinayotte
gcarmich wrote:WiFi.macAddress()

Unfortunately, this gives MAC of the server, not the MAC of the client connected to the server ...