Can udp client got server MAC?

Snipaste_2024-01-27_10-40-35

if((ret=getSn_RX_RSR(0))>0)
{ 
  memset(gDATABUF,0,ret+1);
  recvfrom(0,gDATABUF, ret, DstIP,&DstPort);
  sendto(0,gDATABUF,data_length, DstIP, DstPort);
}

DstIP is udp server ip, DstPort is port, but how can I get server MAC

1 Like


Good question. There seems to be no way to know MAC address from the received packet, but when you send UDP packet back to the target IP you’d get MAC address in the DHAR. So after your sendto you can obtain the MAC address, but not before it.

Many thanks! ARP can slove it.