开发者

Get Client IP address:port (System.Runtime.Remoting.Channels)

开发者 https://www.devze.com 2022-12-17 02:26 出处:网络
I am trying to get a Client IP address & port for an in开发者_如何转开发ternal collection. I found this answer. However, this seems like a lot more than what I need to simply grab the client\'s IP

I am trying to get a Client IP address & port for an in开发者_如何转开发ternal 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消