Click here to Skip to main content
15,896,726 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I try to get the IP address of a dyndns server.
I have tried several methodes.
Doing it by hand with a "ping myserver.dnsalias.net" works fine
By C#
C#
System.Net.Dns.GetHostAddresses("myserver.dnsalias.net")

or
C#
Dns.GetHostEntry("myserver.dnsalis.net");

or
C#
pingSender.Send("myserver.dnsalis.net" );


always returns a wrong or maybe old address.
Any idea what to do ?

regards
Peter
Posted
Updated 3-Sep-11 1:53am
v2

1 solution

Thank you, but this is one of the option that I have tried.
All IP adresses which are returned (at least two) are wrong. Same for the other two functions I have tried :

Dns.GetHostEntry("myserver.dnsalis.net");

and

pingSender.Send("myserver.dnsalis.net" );

All methodes lead to the same wrong IP adress.
Same computer same network the test with command line "ping" works.

I have tried to see the DNS request of the c# program by wireshark, but I didn't found it. Doing the test by command line "ping" I can see the DNS request with wireshark. Maybe there is a configuration I can use for the .net LIB to cache the IP address or to disable a cache ?
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900