http://www.codeproject.com/Tips/358946/Retrieving-IP-and-MAC-addresses-for-a-LAN
LANTools
01 Syntax
Microsoft.VisualBasic.Net.LANTools
02 Methods
| Name | Overloads | Summary |
|---|---|---|
| GetIpNetTable | 1 | GetIpNetTable external method |
| GetAllDevicesOnLAN | 1 | Get the IP and MAC addresses of all known devices on the LAN |
| GetIPAddress | 1 | Gets the IP address of the current PC |
| GetMacAddress | 1 | Gets the MAC address of the current PC. |
| IsMulticast | 1 | Returns true if the specified IP address is a multicast address |
03 Fields
| Name | Overloads | Summary |
|---|---|---|
| ERROR_INSUFFICIENT_BUFFER | 1 | Error codes GetIpNetTable returns that we recognise |
04 Members
GetIpNetTable(
IntPtr, Int32, Boolean)GetIpNetTable external method
Parameters
| Name | Type | Description |
|---|---|---|
pIpNetTable | IntPtr | - |
pdwSize | Int32 | - |
bOrder | Boolean | - |
GetAllDevicesOnLAN
Get the IP and MAC addresses of all known devices on the LAN
Remarks
1) This table is not updated often - it can take some human-scale time to notice that a device has dropped off the network, or a new device has connected. 2) This discards non-local devices if they are found - these are multicast and can be discarded by IP address range.
GetIPAddress
Gets the IP address of the current PC
GetMacAddress
Gets the MAC address of the current PC.
IsMulticast(
IPAddress)Returns true if the specified IP address is a multicast address
Parameters
| Name | Type | Description |
|---|---|---|
ip | IPAddress | - |
ERROR_INSUFFICIENT_BUFFER
Error codes GetIpNetTable returns that we recognise