us**@domain.invalid wrote:
Hello
How can i read IP of incoming connection when i have TcpClient for
that connection ?
Thanx
you can get that from a socket object the RemoteEndPoint propery
returns a IPEndPoint structure you can use.
The slightly trick bit is getting the socket object, there are 2
options..
1./ The TcpClient class has a Socket property, but it is protected, so
you could create a custom class that derives from it.
2./ You can use the TcpListener.AcceptSocket method which returns a
socket. (you can create a network stream from the socket that you can
use to create BinaryReader and binaryWriter objects)
then you simply use the socket i.e.
(IpEndPoint)socket.RemoteEndPoint.Address.ToString ();
Hope that Helps.
Regards Tim.