VB.NET2010 怎么获取IP
1.获取当前电脑名:System.Net.Dns.GetHostName()
创新互联主营安化网站建设的网络公司,主营网站建设方案,手机APP定制开发,安化h5微信小程序搭建,安化网站营销推广欢迎安化等地区企业咨询
2.根据电脑名取出全部IP地址:System.Net.Dns.Resolve(电脑名).AddressList
或者 System.Net.Dns.GetHostByName(电脑名).AddressList
3.根据IP地址取出电脑名:System.Net.Dns.Resolve(IP地址).HostName
求大神指点 vb.net 的IPEndPoint 要怎么才能获取客户端的IP地址或者主机名字呀?
Dim strHostName As String strHostName = Dns.GetHostName() Dim ipEntry As IPHostEntry ipEntry = Dns.GetHostEntry(strHostName) Dim ip As String ip = ipEntry.AddressList(0).ToString()
vb.net 获取局域网计算机的当前用户名和计算机型号等信息
Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Private Sub GetName()
Dim sJM As String
Dim sMC As String
Dim sIP As String
Dim s As String
s = String(128, Chr(0))
GetComputerName s, Len(s)
s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))
sJM = s'计算机名称
s = String(128, Chr(0))
GetUserName s, Len(s)
s = UCase(Left(s, InStr(1, s, Chr(0)) - 1))
sMC = s‘当前用户名称
End Sub
'用这种方法在远程获得再发回本机就可以吧
'取计算机型号暂时不会
请问在VB.NET中怎样获取本机IP?
Dim IPAdress As System.Net.IPAddress
HostName = System.Net.Dns.GetHostName '获得本机的机器名
IPAdress = System.Net.Dns.GetHostByName(HostName).AddressList.GetValue(0) '获得本机的IP
Me.TextBox1.Text = HostName '本机机器名
Me.TextBox2.Text = IPAdress.ToString '本机的IP
文章题目:vb.net获取主机名的简单介绍
文章转载:http://scgulin.cn/article/hecgse.html