Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

get ip address

Status
Not open for further replies.

jazzmaster111

Programmer
May 2, 2005
25
0
0
MX
Hi:

How can I get the client's ip address?

Thanks!!
 
Where you are sitting?
or a client calling a server object over the network from the server?
From Sqlserver?
 
Here's a little function I use for getting the local IP.

Code:
    Public Function LocalIP() As String
        Dim h As System.Net.IPHostEntry = System.Net.Dns.GetHostByName(System.Net.Dns.GetHostName)
        Return CType(h.AddressList.GetValue(0), Net.IPAddress).ToString
    End Function

And here's one to find the Remote IP:
Code:
    Public Function RemoteHostIP(ByVal _Client As Socket) As String
        Dim iEP As IPEndPoint = _Client.RemoteEndPoint
        Return iEP.Address.ToString
    End Function

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top