你可以用比如花生壳之类的,固定你的ip地址(也就是用域名)。
直接获取,参考
Dim httpURL As New System.Uri("http://2019.ip138.com/ic.asp")
Dim httpReq As System.Net.HttpWebRequest = System.Net.WebRequest.Create(httpURL)
httpReq.Method = "GET"
Dim httpResp As System.Net.HttpWebResponse = httpReq.GetResponse()
httpReq.KeepAlive = False
Dim reader As New IO.StreamReader(httpResp.GetResponseStream, System.Text.Encoding.GetEncoding(-0))
Dim respHTML As String = reader.ReadToEnd()
Dim wip As String ''外网IP
Dim qy As String '.IP所属区域
Dim mc = System.Text.RegularExpressions.Regex.Matches(respHTML , "[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+")
If mc.count > 0 Then
wip = mc(0).value
Dim ss As String = respHTML.SubString(respHTML.IndexOf("来自")+3)
qy = ss.SubString(0,ss.IndexOf("<"))
End If
msgbox(wip)