473,406 Members | 2,549 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

How to get the local IPv6 address in WinXP

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
3 5852
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
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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Johnny | last post by:
Now I am running PHP in Apache on Windows platform, but I need to migrate it into linux and using IPv6 instead. So I want to know if PHP fully support IPv6. And how about the workload of this...
7
by: Torsten Schmidt | last post by:
Hi, I'm trying to connect to a mysql-Server using PHP's mysql-function mysql_connect. The host on which the mysql-server is running is not the same as the host apache and php are running on. The...
2
by: PaulH | last post by:
I am attempting to write a functon that can perform IPv6 compliant pings. But, Icmp6SendEcho2 causes an access violation whenever it is called: First-chance exception at 0x76d641e8 in mping2.exe:...
0
by: Addam | last post by:
Anyone, I am writting a server that accepts a list of IPv4 and IPv6 address. The IPv4 address are padded with leading zeros. I belive this allows me to just point to the beging and run both IPv4...
8
by: prabhuram.k | last post by:
Can anybody know how to validate IPV4 and IPV6 address in C++
3
by: jiri.juranek | last post by:
Hello, is there any common function for validation if string contains valid ip address(both ipv4 and ipv6)? Or does sb wrote some regular expression for this? thanks J
2
by: Valerie Hough | last post by:
My app has so far only encountered IPv4 addresses and I use: Dns.GetHostByName( "someOtherComputer", portNumber ).AddressList. Can someone please point me to an example of how to turn this into...
2
by: Prabhu Gurumurthy | last post by:
Hello list, I would like to parse IPv6 addresses and subnet using re module in python. I am able to either parse the ipv6 address or ipv6 network but not both using single line. any help...
8
by: Giampaolo Rodola' | last post by:
I'm not sure if this is a question about python programming, system administration or sockets in general... I have the FTP server in my signature to which I'd want to add IPv6 support. My hosting...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.