We just copy it then create a class:
Imports System.Management
Imports System.Net.NetworkInformation
'---------------------------------------------------------------------------------------
'File Name: clsIP.vb
'File Desc: Class for getting ip from client
'---------------------------------------------------------------------------------------
' Date Developer Updated Description
'---------------------------------------------------------------------------------------
' August-26-2011 Sout Saret New
'---------------------------------------------------------------------------------------
Public Class clsIP
'-----------------------------------------------------------------------------------
'Method Name : PF_GetIP
'Method Desc : Get the ip from client
'Parameter : N/A
'Return Type : String
'-----------------------------------------------------------------------------------
' Date Developer Updated Description
'-----------------------------------------------------------------------------------
' August-26-2011 Sout Saret New
'-----------------------------------------------------------------------------------
Public Shared Function PF_GetIP() As String
Dim m_MyHost As String = System.Net.Dns.GetHostName
Dim myIPs As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(m_MyHost)
For Each myIP As System.Net.IPAddress In myIPs.AddressList
Return myIP.ToString
Next
If myIPs.ToString Then
Return myIPs.ToString
End If
Return Nothing
End Function
'-----------------------------------------------------------------------------------
'Method Name : PF_GetHostName
'Method Desc : Get the name from client
'Parameter : N/A
'Return Type : String
'-----------------------------------------------------------------------------------
' Date Developer Updated Description
'-----------------------------------------------------------------------------------
' August-26-2011 Sout Saret New
'-----------------------------------------------------------------------------------
Public Shared Function PF_GetHostName() As String
Return System.Environment.MachineName
End Function
'-----------------------------------------------------------------------------------
'Method Name : PF_GetMacAddress
'Method Desc : Get the macaddress from client
'Parameter : N/A
'Return Type : String
'-----------------------------------------------------------------------------------
' Date Developer Updated Description
'-----------------------------------------------------------------------------------
' August-26-2011 Sout Saret New
'-----------------------------------------------------------------------------------
Public Shared Function PF_GetMacAddress() As String
Dim M_networkcard() As NetworkInterface = NetworkInterface.GetAllNetworkInterfaces()
Dim M_netCard As String = M_networkcard(0).GetPhysicalAddress.ToString()
Return M_netCard
End Function
End Class
No comments:
Post a Comment