Encapsulate an IPv4 network address.
Note that $(U IpAddress) currently doesn't support IPv6 nor other types of network addresses.
1 // an invalid address 2 IpAddress a0; 3 4 // an invalid address (same as a0) 5 IpAddress a1 = IpAddress.None; 6 7 // the local host address 8 IpAddress a2 = IpAddress("127.0.0.1"); 9 10 // the broadcast address 11 IpAddress a3 = IpAddress.Broadcast; 12 13 // a local address 14 IpAddress a4 = IpAddress(192, 168, 1, 56); 15 16 // a local address created from a network name 17 IpAddress a5 = IpAddress("my_computer"); 18 19 // a distant address 20 IpAddress a6 = IpAddress("89.54.1.169"); 21 22 // a distant address created from a network name 23 IpAddress a7("www.google.com"); 24 25 // my address on the local network 26 IpAddress a8 = IpAddress.getLocalAddress(); 27 28 // my address on the internet 29 IpAddress a9 = IpAddress.getPublicAddress();
$(U IpAddress) is a utility class for manipulating network addresses. It provides a set a implicit constructors and conversion functions to easily build or transform an IP address from/to various representations.