NetBurner 3.3.9
PDF Version
IP Address Object (IPADDR)

IPADDR IP Address Object Example

An IPADDR object is a C++ object that can contain either an IPv4 or IPv6 IP address. An object is used to enable application support both IPv4 and IPv6 without having to change source code. Once you assign an address to the object, it's member functions will automatically call the appropriate member function for the task to be performed.

For example, if you have an IPADDR object named myIPaddr and assign it a value of 192.168.1.10, then calling myIPaddr.print() will print the address in IPv4 notation. If you assign it an IPv6 address, calling myIPaddr.print() will print the address in IPv6 notation.

The NetBurner system has added a printf formatting option of "%I", enabling you to easily display IP addresses with formatting. For example, iprintf("My IP address is %I\r\n", myIPaddr); This formatting option works for all printf variants, such as printf, iprintf, sprintf, etc.

In rare cases in which you want to create an object of a specific type, you can create objects as IPADDR4 or IPADDR6. However, we highly recommend using IPADDR for all your IP addresses. Note that if you are using a printf style format specifier, you must use "%HI" instead of "%I" and pass in a IPADDR4 object, otherwise the value displayed will be 0.0.0.0.