By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,630 Members | 1,121 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,630 IT Pros & Developers. It's quick & easy.

How to get the local IPv6 address in WinXP

P: n/a
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
Nov 16 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

Nov 16 '05 #2

P: n/a
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


Nov 16 '05 #3

P: n/a
Maybe your WinXP is not connected to the internet, I have no other idea :)
Maybe the currrent User rights prevent you from seeing another IPAdress?
Do you have a proxy? Is is properly configured?
What is if you use "ipconfig" from the console? What does it display?
These are just ideas, as I also have no clue :)

--
cody

Freeware Tools, Games and Humour
http://www.deutronium.de.vu || http://www.deutronium.tk
"Frank Jiao" <ji*****@hotmail.com> schrieb im Newsbeitrag
news:#D**************@tk2msftngp13.phx.gbl...
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



Nov 16 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.