I've two machines: Server & Client when I ask for the client ip in the client machine by
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.
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!
What's the problem?
That happend to me one day... the problem is using vmware! when I tried to connect to a real network...I got the correct IP's Try to do it with a real network!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.