-->
Page 1 of 1

|MAC Address and UDP

PostPosted: Tue Nov 16, 2021 1:07 pm
by rvinaso
Hello my friends, I have designed a network with 5 NodeMCUs connected to a router. One of this NodeMCUs will work as master of the network, and the others are slaves. I am using UDP protocol to establish communication between the devices. My question is: How can I get the MAC Address of all the devices connected to the network? Can I obtain it from an incoming packet?? thanks for your help!!

Re: |MAC Address and UDP

PostPosted: Wed Nov 17, 2021 5:07 am
by AcmeUK
You can set your own MAC addresses:- Get ESP32/ESP8266 MAC Address and Change It (Arduino IDE)
Or, if you explicitly need to extract the MAC address see this post UDP With ESP8266 Access Point and for ideas look at the section vis:-

IPaddress = &stat_info->ip;
address = IPaddress->addr;

Serial.print("client= ");

Serial.print(i);
Serial.print(" IP adress is = ");
Serial.print((address));
Serial.print(" with MAC adress is = ");

Serial.print(stat_info->bssid[0],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[1],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[2],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[3],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[4],HEX);Serial.print(" ");
Serial.print(stat_info->bssid[5],HEX);Serial.print(" ");