By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,312 Members | 1,248 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,312 IT Pros & Developers. It's quick & easy.

IPv6 address to string conversions

P: n/a
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 addresses and IPv6 address though
the same conversion function. However, i am having a hard time finding a
simple way to this. I do not want to communicate with the addresses so i
would like to avoid setting up anything extra.
So does anyone have an example on how to convert a IPv4 and IPv6
address. from a char* to a user readable address.

i would prefer to use a built in library to do this. Like winsock2.h

i.e.
IPv4 (actually i can do this but i would like to use the same method to
do both 6 and 4) looks like 0 0 0 0 0 0 0 0 0 0 0 0 149 45 54 98 in the
message and I want to display it as 149.45.54.98

IPv6 looks like 254 128 0 0 0 0 0 0 2 224 41 255 254 108 142 104 and i
want to display it as fe80::2e0:29ff:fe6c:8e68.

~thank you for helping
Addam
Dec 13 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.