做exe程序獲取本機(jī)IP地址用
創(chuàng)新互聯(lián)是一家專(zhuān)注于網(wǎng)站制作、成都網(wǎng)站設(shè)計(jì)與策劃設(shè)計(jì),金平網(wǎng)站建設(shè)哪家好?創(chuàng)新互聯(lián)做網(wǎng)站,專(zhuān)注于網(wǎng)站建設(shè)十余年,網(wǎng)設(shè)計(jì)領(lǐng)域的專(zhuān)業(yè)建站公司;建站業(yè)務(wù)涵蓋:金平等地區(qū)。金平做網(wǎng)站價(jià)格咨詢:028-86922220
System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName()).AddressList
做web程序獲取客戶端的IP地址用
HttpContext.Current.Request.ServerVariables("REMOTE_ADDR"])
Dim IPAdress As System.Net.IPAddress
HostName = System.Net.Dns.GetHostName '獲得本機(jī)的機(jī)器名
IPAdress = System.Net.Dns.GetHostByName(HostName).AddressList.GetValue(0) '獲得本機(jī)的IP
Me.TextBox1.Text = HostName '本機(jī)機(jī)器名
Me.TextBox2.Text = IPAdress.ToString '本機(jī)的IP
定義以下過(guò)程即可獲取本機(jī)ip地址
Sub?GetMyIP()
Dim?strComputer?As?String
Dim?objWMI??????As?Object
Dim?colIP???????As?Object
Dim?IP??????????As?Object
Dim?I???????????As?Integer
strComputer?=?"."
Set?objWMI?=?GetObject("winmgmts://"??strComputer??"/root/cimv2")
Set?colIP?=?objWMI.ExecQuery?_
("Select?*?from?Win32_NetworkAdapterConfiguration?where?IPEnabled=TRUE")
For?Each?IP?In?colIP
If?Not?IsNull(IP.IPAddress)?Then
For?I?=?LBound(IP.IPAddress)?To?UBound(IP.IPAddress)
MsgBox?"IP??地址:"??IP.IPAddress(I)??Chr(10)??_
Next
End?If
Next
End?Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim cc() As System.Net.IPAddress = System.Net.Dns.GetHostEntry(System.Net.Dns.GetHostName()).AddressList
Dim str As String = ""
For Each ws In cc
str = str ws.ToString vbCrLf
Next
MsgBox(str)
End Sub
名稱(chēng)欄目:vb.net獲取本機(jī)ip的簡(jiǎn)單介紹
網(wǎng)站網(wǎng)址:http://jinyejixie.com/article22/hopdcc.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供外貿(mào)建站、品牌網(wǎng)站設(shè)計(jì)、App設(shè)計(jì)、虛擬主機(jī)、標(biāo)簽優(yōu)化、微信小程序
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)