How do I convert an IPv4 addres to IPv6 in C#?

V

Valerie Hough

My app has so far only encountered IPv4 addresses and I use:
Dns.GetHostByName( "someOtherComputer", portNumber ).AddressList[0].

Can someone please point me to an example of how to turn this into an IPv6
address?

Thanks in advance.
Chris Hough
 
K

Kevin Spencer

An IPv4 address is translated to an IPv6 address by placing the 4 octets of
the IPv4 address into the rightmost 4 octets of the IPv6 address.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 
K

Kevin Spencer

Forgot to mention: After inserting the 4 octets of the IPv4 address into the
rightmost 4 octets of the IPv6 address, the remaining left-most octets would
be 0 in value.

--
HTH,

Kevin Spencer
Microsoft MVP

DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top