EDN Admin
Well-known member
Code:
Public Shared Function GetMac(ByVal ipAddr As String) As String
Dim macAddress As String = String.Empty
Try
Dim destIP As Net.IPAddress = Net.IPAddress.Parse(ipAddr)
Dim IP() As Byte = destIP.GetAddressBytes()
Dim IPInt As Int32 = BitConverter.ToInt32(IP, 0)
Dim mac() As Byte = New Byte(5) {}
SendARP(IPInt, 0, mac, mac.Length)
macAddress = BitConverter.ToString(mac, 0, mac.Length)
Catch ex As Exception
Debug.Write(ex.Message)
End Try
Return macAddress
End Function
Private Sub button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles button1.Click
Me.MACAddressDisplayLabel.Text = GetMac(Me.MacLocalIPAddressBox.Text)
End Sub
Last edited by a moderator: