I am reading a 32 bit register (UINT32) and I need a simple function which will convert it into an ipaddress
I have been told by the C++ programmer the following
The IP Address is encoded as: www.xxx.yyy.zzz e.g. 192.168.001.001
32 bit number (Uint_32) 0xaabbccdd named IPAddr
www = (IPAddr >> 24) & 0xFF
xxx = (IPAddr >> 16) & 0xFF
yyy = (IPAddr >> 8) & 0xFF
zzz = (IPAddr & 0xFF
At the moment I read the register into a byte array g3_data(0) , g3_data(1) , g3_data(2) , g3_data(3)
and then convert it to a string for displaying ( the same routine is used for other registers )
valstr = BitConverter.ToInt32(g3_data, 0).ToString()
Can someone please show me how to convert this byte array or string into the ip address in vb.net
Many thanks
I have been told by the C++ programmer the following
The IP Address is encoded as: www.xxx.yyy.zzz e.g. 192.168.001.001
32 bit number (Uint_32) 0xaabbccdd named IPAddr
www = (IPAddr >> 24) & 0xFF
xxx = (IPAddr >> 16) & 0xFF
yyy = (IPAddr >> 8) & 0xFF
zzz = (IPAddr & 0xFF
At the moment I read the register into a byte array g3_data(0) , g3_data(1) , g3_data(2) , g3_data(3)
and then convert it to a string for displaying ( the same routine is used for other registers )
valstr = BitConverter.ToInt32(g3_data, 0).ToString()
Can someone please show me how to convert this byte array or string into the ip address in vb.net
Many thanks