browse: forums | FAQ
Connecting Tech Pros Worldwide

Hey there! Do you need C# / C Sharp help?

Get answers from our community of C# / C Sharp experts on BYTES! It's free.

Obtaining IP Address from hex string

Newbie
 
Join Date: Oct 2009
Posts: 1
#1: Oct 12 '09
Hi all

I have an IP Address represented as the following string. Each 2 characters form essentially an octet in a IPv4 address.

The string that I have is 3264A8C0. Using a calculator I see that this computes to 50.100.168.192 and I wanted to know if there are any C# class .NET classes that can parse and output this as a string in the form 192.168.100.50 (note the order is reversed).

Thank you

M



ssnaik84's Avatar
Familiar Sight
 
Join Date: Aug 2009
Location: Bengaluru, India
Posts: 150
#2: Oct 13 '09

re: Obtaining IP Address from hex string


1. you have to split two-two characters
2. convert hex value to int
Expand|Select|Wrap|Line Numbers
  1. int.Parse(yourHexValue, System.Globalization.NumberStyles.HexNumber);
3. then concat all int values with "."
Reply