[英]HttpListener Remote IP Address (client)
So I am using HttpListener (webSocket) to listen for a connection. 所以我正在使用HttpListener(webSocket)来监听连接。 A connection is received and fires the event to deal with the context:
接收到连接并触发事件以处理上下文:
private void WebSocketServer_OnWebSocketContext(object sender, System.Net.WebSockets.HttpListenerWebSocketContext context)
{
OnWebSocketContext(context);
}
private async void OnWebSocketContext(System.Net.WebSockets.HttpListenerWebSocketContext context)
{
...
}
My question is, how do I get the connecting machine's IP address. 我的问题是,如何获得连接机器的IP地址。 This is all done via a browser (obviously http).
这些都是通过浏览器(显然是http)完成的。 I cannot figure where the IP address of the connecting machine is found in the context (or is it)??
我无法确定在上下文中找到连接机器IP地址的位置(还是它)??
字符串ipAddress = httpListenerContext.Request.RemoteEndPoint.Address.ToString();
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.