根据IP地址获得MAC

Imports System
Imports System.Diagnostics


Public Class MacAddress
Public Function GetMac(ByVal IP As String) As String
Dim str1 As String = String.Empty
Try
Dim str2 As String = String.Empty
Dim info1 As ProcessStartInfo = New ProcessStartInfo()
Dim process1 As Process = New Process()

info1.FileName = "nbtstat"
info1.RedirectStandardInput = False
info1.RedirectStandardOutput = True
info1.Arguments = "-A " + IP
info1.UseShellExecute = False
process1 = Process.Start(info1)

Dim num1 As Integer = -1

While (num1 <= -1)
num1 = str2.Trim().ToLower().IndexOf("mac address", 0)
If (num1 > -1) Then
Exit While
End If

str2 = process1.StandardOutput.ReadLine()
process1.WaitForExit()
str1 = str2.Trim()
End While
Catch ex As Exception
Throw ex
End Try


Return str1
End Function

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值