Hi, cody
thank you very much, I try to use your method, but the same result
In the both OS, I can get two IPv6 address.
In Win2003, I can get four value(two IPv6 address/one is IPv6loopback
address/one is IPv4 address) after "IPHostEntry hostEntry = Dns.Resolve(
localName )", but there are only two value(one is IPv6loopback address/one
is IPv4 address) in WinXP. So I think the problem is DNS, but I don't know
how to resovle it.
Thank you
"cody" <no****************@gmx.net>
news:O3**************@TK2MSFTNGP11.phx.gbl...
Iam no expert but could it be due to internal Firewall?
However instead of "if(curAdd.AddressFamily.ToString() ==
ProtocolFamily.InterNetworkV6.ToString())"
you should write "if (curAdd.AddressFamily==AddressFamily.InterNetworkV 6)"
You should never rely on a specific representation of ToString(), because
it can depend on current culture and framework version.
--
cody
Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"Frank Jiao" <ji*****@hotmail.com> schrieb im Newsbeitrag
news:OB**************@TK2MSFTNGP11.phx.gbl... I can get my local IPv6 address in Win2003 use the source code as below:
string localName = Dns.GetHostName();
string address = "";
string scopeId = "";
IPHostEntry hostEntry = Dns.Resolve( localName );
foreach (IPAddress curAdd in hostEntry.AddressList)
{
if(curAdd.AddressFamily.ToString() ==
ProtocolFamily.InterNetworkV6.ToString())
{
scopeId = curAdd.ScopeId.ToString();
address = curAdd.ToString();
break;
}
}
Then, I set the config about IPv6 in WinXP as the same as Win2003. when
I run the source code in WinXP, I can only get the loopback(::1) address
but not local IPv6 address.
Thank you for your help!
Frank Jiao