Human readable DhcpInfo.ipAddress?

后端 未结 5 2143
臣服心动
臣服心动 2021-02-15 10:31

I am wondering how to get a human readable IP Adress from DhcpInfo.ipAddress? The tricky thing about it is, that it is an integer and obviously you can\'t store an IP address in

5条回答
  •  天涯浪人
    2021-02-15 11:07

    You can actually.

    IP address as int is: AABBCCDD and in human-readable form it is AA.BB.CC.DD but in decimal base. As you see you can easily extract them using bitwise operations or by converting int to byte array.

    See the picture:

    enter image description here

提交回复
热议问题