472,805 Members | 1,507 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

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

Similar topics

0
by: Agent | last post by:
I would like to invite you and your associates to attend the US IPv6 (Internet Protocol version 6) Summit, December 8-11, 2003 in Crystal City, VA, near the Pentagon. This major opportunity to...
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: Jason | last post by:
I've got a program that wil convert an IP address to decimal. Anyone give me any infor on how I would modify this program that I had converting regular IPs to decimal, hwo would I make it work...
65
by: kyle.tk | last post by:
I am trying to write a function to convert an ipv4 address that is held in the string char *ip to its long value equivalent. Here is what I have right now, but I can't seem to get it to work. ...
3
by: fusillo | last post by:
hi, i would like know about mysql's ipv6 support, i installed mysql 5.0.19 from a source dist and no configuration option is provided to enable ipv6. do you know some tips about? regards ...
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...
1
by: =?Utf-8?B?V2lsbGlhbSBSYW5kbGV0dA==?= | last post by:
The System.Uri class is not behaving as I expect when an IPv4 address is embedded within an IPv6 address. The following test works fine, using IPv6 only: public void...
14
by: Simon | last post by:
Hi, is there a straight forward way of converting IPv4 to IPv6? I thought that it was just a matter of converting 32 bits to 128 bits, (by adding 96 leading 0s), but that does not seem right...
0
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
0
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
0
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?
0
by: Mushico | last post by:
How to calculate date of retirement from date of birth

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.