更新时间:2022-01-05 21:40:38
从哪一方?如果你在谈论服务器,那么Socket.Accept
返回一个套接字,你可以从属性获得远程IP
Socket.RemoteEndPoint。如果你想在客户端获得客户端IP,你需要在.NET 1.x中调用Dns.Resolve()或在.NET 2中调用Dns.GetHostAddresses()。
>
-
Vit Zayko
From which side? If you are talking about server then Socket.Accept
returns a socket and you can get remote IP from property
Socket.RemoteEndPoint. If you want to get client IP on client side you
should call Dns.Resolve() in .NET 1.x or Dns.GetHostAddresses() in .NET 2.
--
Vit Zayko
我想在连接的客户端服务器上获取IP地址
i得到socket.LocalEndpoint但是无法获得
socket.RemoteEndpoint
i want to get ip address on server of client which is connected
i am getting socket.LocalEndpoint but not able to get
socket.RemoteEndpoint
我想在客户端的服务器上获取ip地址已连接
i我正在获取socket.LocalEndpoint但无法获得
socket.RemoteEndpoint
i want to get ip address on server of client which is connected
i am getting socket.LocalEndpoint but not able to get
socket.RemoteEndpoint