Discussion:
How to get TCPClient's IP from TCPListener
(too old to reply)
zZ
2003-10-15 09:37:59 UTC
Permalink
Hi All,

I'm building a TCPListener as the server to accept TCPClient connections,
using

TCPListener.AcceptTcpClient.

I'd like to retrieve client's IP after connected, but found no way to do so.
Is there a walkaround? Thanks for any tip.


Kind regards,
Zen
Bill
2003-10-15 17:56:19 UTC
Permalink
TCPClient tc = TCPListener.AcceptTcpClient();
Socket s = tc.Client;
Console.WriteLine("I am connected to " +
IPAddress.Parse(((IPEndPoint)s.RemoteEndPoint).Address.ToString()) +
"on port number " + ((IPEndPoint)s.RemoteEndPoint).Port.ToString());


http://www.freesmtp.net

socket.RemoteEndPoint
Post by zZ
Hi All,
I'm building a TCPListener as the server to accept TCPClient connections,
using
TCPListener.AcceptTcpClient.
I'd like to retrieve client's IP after connected, but found no way to do so.
Is there a walkaround? Thanks for any tip.
Kind regards,
Zen
Loading...