How do you get the host address and port from a System.Net.EndPoint?

Posted by cyclotis04 on Stack Overflow See other posts from Stack Overflow or by cyclotis04
Published on 2010-05-27T03:27:32Z Indexed on 2010/05/27 3:31 UTC
Read the original article Hit count: 243

Filed under:
|
|
|

I'm using a TcpClient passed to me from a TcpListener, and for the life of me I can't figure out a simple way to get the address and port it's connected to.

The best I have so far is _client.Client.RemoteEndPoint.ToString(); which returns a string in the form FFFF::FFFF:FFFF:FFF:FFFF%00:0000. I've managed to extract the address and port using Regular Expressions, but this seems like overkill. What am I missing?

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET