I have a IPv4 address provided as a uint and I would like to convert it to string (for the purpose of logging).
I would normally achieve this in C# using the System.Net.IPAddress constructor...but it seems that System.Net.IPAddress is not available in C# for WinRT/Windows Store. Does anyone have an equivalent way to do this conversion?
Thank you.
A little "dirty", but seems to work
uint ip = 0xFFDF5F4F;
var bytes = BitConverter.GetBytes(ip);
string res = string.Join(".", bytes.Reverse());
Output is 255.223.95.79 for this case
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With