There are generally two formats for storing IP addresses in the IP address database, one is dotted decimal format (192.168.1.1), and the other is digital format (3232235777). In applications, it is often necessary to convert between these two formats.
To solve this problem, I implemented a quick method for converting between the two in the exnet extension package:
Example of use:
So how do you convert a dotted decimal IP address into a number? An IPv4 address has 4 bytes and looks like this:
Each byte represents the range:
General formula: b4<<24 | b3<<16 | b2<<16 | b1 For example, 222.173.108.86 Conversion method: 222<<24 | 173<<16 | 108<<8 | 86 = 3735907414 For example, 1.0.1.1 Conversion method: 1<<24 | 0<<16 | 1<<8 | 1 = 16777473 The implementation in exnet is as follows:
Just flip the logic of converting a numeric value to a string. This is implemented in exnet as follows:
|
<<: When porting your number to another network, operators should first change their service mindset
[[327272]] What is the core competitiveness of op...
Everyone needs Wi-Fi at home, but for various rea...
Recently, the foreign research organization OpenS...
According to foreign media, Dish Network announce...
On September 24, during Huawei Connect 2020, Huaw...
According to a report by the Financial Times (FT....
The technical specifications related to 5G NR are...
If we take stock of the hottest trends in the tec...
The hype about 5G has masked many problems. For C...
The development of computer networks has come a l...
Kvmla is a domestic veteran hosting company, a br...
iOVZ has just launched a Western Valentine's ...
On April 12, the China Academy of Information and...
[[346255]] On the one hand, it is because various...
5G networks are set to revolutionize the Internet...