[英]On the Server: Getting IP Address of Connected Clients
I've two machines: Server & Client when I ask for the client ip in the client machine by 我有两台计算机:服务器和客户端,当我通过以下方式在客户端计算机中请求客户端IP时
TcpClient client = new TcpClient();
client.Connect(serverip, PORTNO);
MessageBox.Show(client.Client.LocalEndPoint.ToString());
I get: 192.168.241.128:1025 It's the client ip. 我得到:192.168.241.128:1025这是客户端IP。
but when I apply on the server the following: 但是当我在服务器上申请以下内容时:
_client = client;
_clientIP = client.Client.RemoteEndPoint.ToString();
AllClients.Add(_clientIP, this);
data = new byte[_client.ReceiveBufferSize];
_client.GetStream().BeginRead(data, 0, System.Convert.ToInt32(_client.ReceiveBufferSize), ReceiveMessage, null);
MessageBox.Show(client.Client.RemoteEndPoint.ToString());
I get 192.168.92.1:1047 which is the server ip! 我得到192.168.92.1:1047这是服务器IP!
What's the problem? 有什么问题?
That happend to me one day... the problem is using vmware! 有一天,发生在我身上的问题是使用vmware! when I tried to connect to a real network...I got the correct IP's Try to do it with a real network!
当我尝试连接到真实网络时...我获得了正确的IP尝试在真实网络中实现!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.