Socket Connection - Wrong address is returned

Hi,

I'm using socket connection to connect pocket pc (client) and my computer (server).

When I run the program on the emulator, I'm able to establish a connection. At the server, I print the remotePoint from which the connection was accepted. I always get the unassigned IPAddress "127.0.0.1" printed.

I have been trying to figure it out myself, but in vain..Can anyone please tell me why this happens

Thank you so much.

/******Server******/

IPEndPoint myEndPoint = new IPEndPoint(IPAddress.Any, 5155);

Socket mySocket = new Socket(myEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

mySocket.Bind(myEndPoint);

mySocket.Listen(int.MaxValue);

Console.WriteLine("Server listening...");

while (true)

{

try

{

Socket client = mySocket.Accept();

Console.WriteLine("Accepted connection from : {0}", client.RemoteEndPoint.ToString());

....

/************Client************/

IPHostEntry remoteEntry = Dns.GetHostEntry("archane");

for (int i = 0; i < remoteEntry.AddressList.Length; i++)

{

IPAddress remoteAddress = remoteEntry.AddressList;

IPEndPoint remotePoint = new IPEndPoint(remoteAddress, 5155);

Socket connSocket = new Socket(remoteAddress.AddressFamily, SocketType.Stream, ProtocolType.Tcp);

try

{

connSocket.Connect(remotePoint);

label1.Text = "Connected to : " + remotePoint.ToString(); //The remotePoint here is printed correctly



Answer this question

Socket Connection - Wrong address is returned