Get remote MAC from UDP packet

I know I can get the IP address and port of a UDP message (e.g. remoteIP(), remotePort() ) I need to get the MAC address. I am using the WiFiUdp.h library on my NodeMCU 1.0 (ESP-12E module)

Do you write the code for the UDP-sending unit yourself?

If yes one way is to just add the mac-adress to the data you are sending via UDP

Not sure if the AsyncUDP is an option. The AsyncUDP is written for ESP32

AsyncUDP has a function

void AsyncUDPPacket::remoteMac(uint8_t * mac)
    memcpy(mac, _remoteMac, 6);

best regards Stefan

I don't think you can get the MAC address from a UDP message. When the ethernet packet(s) that brought it were on the wire, the MAC was in play. By the time it's delivered up your stack as UDP, it's no longer part of the protocol and was dropped.

I am not sure if you could tweak the library or if (more likely) it doesn't even make it off the ethernet/WiFi shield.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.