SendArp using Iphlpapi.dll

Twazok

New member
Joined
May 29, 2007
Messages
2
Programming Experience
Beginner
HI there

I have found the above dll that will help me try and obtain a mac address of remote machines however i cannot seem to implement it correctly. I have set the function out like this:

Private Declare Function SendARP Lib "iphlpapi.dll" (ByVal DestIP As integer, ByVal SrcIP As Integer, ByRef pMacAddr As Integer, ByRef PhyAddrLen As Integer) As Integer

The api seems to want them all as integers however i dont know how to set the ip address as an integer or how to correctly get it all to process correctly. Any help would be greatly appreciated. Also if there is a better way of obtaining mac addresses i would gladly try it.

Many Thanks
Steve
 
Run the WMI Code Creator (some info), configure it for VB.Net code language and Remote target computer and query Win32_NetworkAdapter or Win32_NetworkAdapterConfiguration with the properties you want, this should get you the WMI code to figure it out.
 
To use WMI i would have to rely on the target to be powered on. The code i am writing is actually going to be used to wake remote machines that are currently switched off (sorry for not specifying) so will need to obtain the MAC in some other fashion. I was thinking about pulling them from the DHCP server, but wouldn't have the fogiest where to start!
 
I don't think you can get this info when the remote is shut down, but you can record it when pc is running because the mac address doesn't change even if the IP is upon startup, there is no IP associated with the adapter when pc is off. For WOL the magic packet is broadcasted with UDP to all adapters connected to network and a matching adapter will signal the pc if this feature is enabled. I don't know other server systems where you can retrieve such info of previous connections either.
 
Back
Top