Hello,
I'm using one of the TCP examples to do a small project, but I'm stuck. Basically, I wanted to display the MAC address and the IP address of everyone connected. I did the IP part, but I don't know how to get the MAC address of a connected client. Any help?
Question about getting a clients MAC address
Re: Question about getting a clients MAC address
The public interface way if speed is not an issue:
from
#include <arp.h>
/*
******************************************************************************
Get the MAC address from an IP address
This does not send and arp it only checks the arp cache.
If you want it to send an arp then ping the address before calling this function.
Parameters ip address to look up.
mac MACADR structure to hold the result.(C++ pass by reference)
Return:
True if it found a valid arp entry.
False if it did not.
******************************************************************************
*/
BOOL GetArpMacFromIp(IPADDR ip,MACADR & ma);
If speed matter do this once and cache the result.
from
#include <arp.h>
/*
******************************************************************************
Get the MAC address from an IP address
This does not send and arp it only checks the arp cache.
If you want it to send an arp then ping the address before calling this function.
Parameters ip address to look up.
mac MACADR structure to hold the result.(C++ pass by reference)
Return:
True if it found a valid arp entry.
False if it did not.
******************************************************************************
*/
BOOL GetArpMacFromIp(IPADDR ip,MACADR & ma);
If speed matter do this once and cache the result.
Re: Question about getting a clients MAC address
Thank you so much, you sir are a life saver.