VS 2008 : Use The DHCP API To Retrieve A Computer's MAC Address When Given The IP Address?Nov 27, 2009
I'm trying to use the DHCP API (using the references on pinvoke.net) to retrieve a computer's MAC address when given the IP address but I can't get the code to work. I've run all the C# code on pinvoke.net through the C#-to-VB converter but I'm stuck now.
Here's what I have so far. The value of res is always 5 (should be 0). Thing is, I can't find any documentation on what the return codes mean
Private Sub GetMACDim client As String = "220.127.116.11" Dim server As String = "0.0.0.0" Dim si As New NativeMethods.DHCP_SEARCH_INFO si.SearchType = NativeMethods.DHCP_SEARCH_INFO_TYPE.DhcpClientIpAddress si.ClientIpAddress = Convert.ToUInt32(StringIPAddressToUint32(client)) Dim res As UInteger Dim oInfo As IntPtr