本文介绍了在C#套接字客户端应用程序中获取客户端IP地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在C#中创建套接字客户端应用程序 如何获取已连接到服务器的客户端的IP地址
I am making socket client application in C# how can i get ip address of client who has connected to server
推荐答案从哪一方?如果你在谈论服务器,那么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
更多推荐
在C#套接字客户端应用程序中获取客户端IP地址
发布评论