I am trying to get a Client IP address & port for an internal collection. I found this answer. However, this seems like a lot more than what I need to simply grab the client's IP address & port. Are there any other ways to do this?
Asked
Active
Viewed 2,563 times
1 Answers
2
There is little reason to assume that it should be easy. Remoting works over TCP, HTTP and IPC channels. The transport mechanisms are abstracted away so they don't get in the way of using Remoting. For a TCP channel, the actual socket is managed by the TcpClientSocketHandler and TcpServerSocketHandler classes. They are internal sealed classes in the .NET framework, you can't get to them from your own code.
The code in the linked post looks okay to me, it is a direct copy of the framework code. I'd recommend you try it.

Hans Passant
- 922,412
- 146
- 1,693
- 2,536
-
I agree. I was just hoping that someone might have another solution. It seems like a lot to do such a simple thing, but it makes sense that the abstraction layers increase the difficulty in getting an IPAddress & Port. Thanks for you confirmation! – IAbstract Jan 23 '10 at 17:12