473,788 Members | 2,814 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

My app has so far only encountered IPv4 addresses and I use:
Dns.GetHostByNa me( "someOtherCompu ter", 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 9432
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******** ******@TK2MSFTN GP06.phx.gbl...
My app has so far only encountered IPv4 addresses and I use:
Dns.GetHostByNa me( "someOtherCompu ter", 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******** ******@TK2MSFTN GP06.phx.gbl...
My app has so far only encountered IPv4 addresses and I use:
Dns.GetHostByNa me( "someOtherCompu ter", 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
1795
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 participate in transitioning to the new Internet is in response to both DoD and Industry requests for a concentrated, affordable conference in the Washington, D.C. area. This exciting and informative conference on the Next Generation Internet will...
7
5953
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 two computers are connected in an IPv6-network. No matter if I give the hostname (defined in /etc/hosts), the IPv6-address ("fec0::4") or the IPv6-address in square brackets ("") the function mysql_connect always prints "Unknown MYSQL-Server "....
2
6397
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: 0xC0000005: Access violation reading location 0x00000000. Unhandled exception at 0x76d641e8 in mping2.exe: 0xC0000005: Access violation reading location 0x00000000. I have been unable to pinpoint the cause of the access violation so far, so I...
0
1310
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 for an IPv6 address? Would I add just 8 instances of converting ? Thanks for any help.... Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
65
21486
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. #include <string.h> #include <stdio.h> /* Convert an ipv4 address to long integer */ /* "192.168.1.1" --> 3232235777 */ unsigned long iptol(char *ip){
3
6115
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 fusillo
2
3725
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 appreciated. BTW is there a metacharacter for hex digits. Thanks Prabhu -
1
2495
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 Uri_ShouldCreateValidUriFromSimpleIPv6Address() { Uri testUri = new Uri("http://:9050"); Assert.AreEqual( "http://:9050/", testUri.ToString());
14
9298
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 in some/most cases. For example, 127.0.0.1, (IPv4 localhost), does not convert ::1, (IPv6 localhost)
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10366
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10173
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8993
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6750
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.