Home > Software engineering >  Through a vb.net do take the client MAC address of the source code
Through a vb.net do take the client MAC address of the source code

Time:11-03

Want to very detailed all code is associated with

CodePudding user response:

VB.Net via IP address to obtain the Mac address
 
Imports System
Imports System. Diagnostics


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

Info1. FileName="nbtstat"
Info1. RedirectStandardInput=False
Info1. RedirectStandardOutput=True
Info1. The Arguments="-a" + IP
Info1. UseShellExecute=False
Process1=Process. The Start (info1)

Dim num1 As Integer=1

While (num1 & lt;=1)
Num1=str2. The Trim (). ToLower (). The IndexOf (" MAC address ", 0)
If (num1 & gt; 1) Then
The Exit While
End the If

Str2=process1. StandardOutput. ReadLine ()
Process1. WaitForExit ()
Str1=str2. The Trim ()
End While
Catch the ex As Exception
Throw the ex
End the Try


Return str1
End the Function
  •  Tags:  
  • API
  • Related