On Tue, 10 Aug 2004 06:00:11 -0700, -J wrote:
When connecting to a server application via a TCP socket connection, how do I retrieve the IP Address of the client computer that is making the connection.
I create and IPEndPoint for the client, then call the connect using the endpoint.
The server application uses TCPListener to pick up client connections.
At this point I want to store the client's IP Address that is making the connection.
Thanks for the help.
-J
___
Newsgroups brought to you courtesy of www.dotnetjohn.com
If your using the TcpClient class for the new connections - you can't,
unless you create your own class that inherits from TcpClient because you
have to access the protected Client property of the TcpClass...
If your using a Socket (TcpListner.AcceptSocket) - then you can use
connections RemoteEndPoint property...
Dim ep as IPEndPoint = DirectCast (clientConnection.RemoteEndPoint,
IPEndPoint)
Dim clientIp As IPAddress = ep.Address
Dim clientPort As Integer = ep.Port
HTH
--
Tom Shelton [MVP]