sys::Obj inet::IpAddr
public class IpAddr
IpAddr models an Internet IPv4 or IPv6 address.
public bool equals(IpAddr that)
Return if this address is equivalent to that address.
public bool isIPv4()
Return if this is a IPv4 mapped address. IPv4 addresses have the first 80 bits set to zero, the next 16 set to one, and the last 32 bits represent the IPv4 address.
public bool loadBuf(Buf addr)
Convenience for loadBytes(addr.bytes, addr.size)
public bool loadBytes(byte[] addr, int len)
Set the IpAddr using a raw byte array. Returns true if the length of the addr is 4-bytes (IPv4) or 16 bytes (IPv6). No validation is done on the raw addr.
public bool parse(Str notation)
Parse the specified string from an IPv4 dotted-quad notation or IPv6 colon-hexdecimal notation into this IpAddr. This method will not resolve a hostname. Return true on success, or false on failure (if the address is illegally formatted).
public void set(IpAddr addr)
This method is used to copy the address of "addr" into this instance.
public Str toStr()
Get the address in string format - dotted-quad notation for IPv4 or colon-hexidecimal notation for IPv6. The string is stored in a static shared buffer.