I tried this a few days ago and failed, but finally got it working today:
This is Windows NT-specific, but the basic process is the same across OSes -- they all use sendarp, inet_addr, etc, as far as I know.
Please note that the demo obtains your public IP from my web site, so may pop up a firewall warning. Just comment those lines out of that's a problem, and specify the local IP you want to retrieve the MAC from. [EDIT: Actually, on XP my public IP has an associated MAC, but on '7 it doesn't, so don't be surprised if that test fails.]
Please note dire warning at bottom of code! Not sure what causes that...
|