根据IP地址获得MAC

王朝other·作者佚名  2006-04-22
窄屏简体版  字體: |||超大  

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

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
 
 
© 2005- 王朝網路 版權所有 導航