G
Guest
I wrote I short program to get my machine's ip:
And everytime I get an odd result, which I don't understand:
I keep getting a list of 3 IP numbers, the first one never changes.
The second and the third are the same numbers but they change everytime I
disconnect and reconnect to the internet.
Here is the code:
Socket reciever= new
Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress=ipHostInfo.AddressList[0];
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11102);
foreach(IPAddress i in ipHostInfo.AddressList)
Console.WriteLine(i.ToString());
The other odd thing is when I write a Client program which tries to coonect
to my machine I succeed to do so only when I use the first ip from the list,
which never changes, when I try to use the other IP nothing happans.
I do it through the function: IPAddress ipAddress = IPAddress.Parse(my ip
which changes every reconnection);
What is this Constant IP number, why do I get a list of 3 IPs and why can't
I coonect to the changing IP?
Thanks for your help
And everytime I get an odd result, which I don't understand:
I keep getting a list of 3 IP numbers, the first one never changes.
The second and the third are the same numbers but they change everytime I
disconnect and reconnect to the internet.
Here is the code:
Socket reciever= new
Socket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp);
IPHostEntry ipHostInfo = Dns.Resolve(Dns.GetHostName());
IPAddress ipAddress=ipHostInfo.AddressList[0];
IPEndPoint localEndPoint = new IPEndPoint(ipAddress, 11102);
foreach(IPAddress i in ipHostInfo.AddressList)
Console.WriteLine(i.ToString());
The other odd thing is when I write a Client program which tries to coonect
to my machine I succeed to do so only when I use the first ip from the list,
which never changes, when I try to use the other IP nothing happans.
I do it through the function: IPAddress ipAddress = IPAddress.Parse(my ip
which changes every reconnection);
What is this Constant IP number, why do I get a list of 3 IPs and why can't
I coonect to the changing IP?
Thanks for your help