467,864 Members | 1,757 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 467,864 developers. It's quick & easy.

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

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
Sep 26 '07 #1
  • viewed: 8939
Share:
2 Replies
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

"Valerie Hough" <sa***@pcTrans.comwrote in message
news:OP**************@TK2MSFTNGP06.phx.gbl...
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

Sep 26 '07 #2
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

"Valerie Hough" <sa***@pcTrans.comwrote in message
news:OP**************@TK2MSFTNGP06.phx.gbl...
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

Sep 26 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Agent | last post: by
7 posts views Thread by Torsten Schmidt | last post: by
2 posts views Thread by PaulH | last post: by
65 posts views Thread by kyle.tk | last post: by
3 posts views Thread by fusillo | last post: by
2 posts views Thread by Prabhu Gurumurthy | last post: by
1 post views Thread by =?Utf-8?B?V2lsbGlhbSBSYW5kbGV0dA==?= | last post: by
14 posts views Thread by Simon | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.