Reputation: 567
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?
Upvotes: 1
Views: 2669
Reputation: 572
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!
Upvotes: 1