glibmm 2.30.0

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Examples

- Class List
- Class Index
- Class Hierarchy
- Class Members

Public Member Functions | Static Public Member Functions | Protected Member Functions | Related Functions

# Gio::InetAddress Class Reference
Portable Network I/O Functionality

An IPv4/IPv6 address. More...

`#include <giomm/inetaddress.h>`

Inheritance diagram for Gio::InetAddress:
[legend]

List of all members.

## Public Member Functions
virtual | ~InetAddress ()
GInetAddress* | gobj ()
| Provides access to the underlying C GObject.
const GInetAddress* | gobj () const
| Provides access to the underlying C GObject.
GInetAddress* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
const guint8* | to_bytes () const
| Gets the raw binary address data from address.
Glib::ustring | to_string () const
| Converts address to string form.
SocketFamily | get_family () const
| Gets address's family.
bool | get_is_any () const
| Tests whether address is the "any" address for its family.
bool | get_is_link_local () const
| Tests whether address is a link-local address (that is, if it identifies a host on a local network that is not connected to the Internet).
bool | get_is_loopback () const
| Tests whether address is the loopback address for its family.
bool | get_is_mc_global () const
| Tests whether address is a global multicast address.
bool | get_is_mc_link_local () const
| Tests whether address is a link-local multicast address.
bool | get_is_mc_node_local () const
| Tests whether address is a node-local multicast address.
bool | get_is_mc_org_local () const
| Tests whether address is an organization-local multicast address.
bool | get_is_mc_site_local () const
| Tests whether address is a site-local multicast address.
bool | get_is_multicast () const
| Tests whether address is a multicast address.
bool | get_is_site_local () const
| Tests whether address is a site-local address such as 10.0.0.1 (that is, the address identifies a host on a local network that can not be reached directly from the Internet, but which may have outgoing Internet connectivity via a NAT or firewall).
gsize | get_native_size () const
| Gets the size of the native raw binary address for address.
Glib::PropertyProxy_ReadOnly < void* > | property_bytes () const
| The raw address data.
Glib::PropertyProxy_ReadOnly < SocketFamily > | property_family () const
| The address family (IPv4 or IPv6).
Glib::PropertyProxy_ReadOnly < bool > | property_is_any () const
| Whether this is the 'any' address for its family.
Glib::PropertyProxy_ReadOnly < bool > | property_is_link_local () const
| Whether this is a link-local address.
Glib::PropertyProxy_ReadOnly < bool > | property_is_loopback () const
| Whether this is the loopback address for its family.
Glib::PropertyProxy_ReadOnly < bool > | property_is_mc_global () const
| Whether this is a global multicast address.
Glib::PropertyProxy_ReadOnly < bool > | property_is_mc_link_local () const
| Whether this is a link-local multicast address.
Glib::PropertyProxy_ReadOnly < bool > | property_is_mc_node_local () const
| Whether this is a node-local multicast address.
Glib::PropertyProxy_ReadOnly < bool > | property_is_mc_org_local () const
| Whether this is an organization-local multicast address.
Glib::PropertyProxy_ReadOnly < bool > | property_is_mc_site_local () const
| Whether this is a site-local multicast address.
Glib::PropertyProxy_ReadOnly < bool > | property_is_multicast () const
| Whether this is a multicast address.
Glib::PropertyProxy_ReadOnly < bool > | property_is_site_local () const
| Whether this is a site-local address.
## Static Public Member Functions
static Glib::RefPtr< InetAddress > | create (const Glib::ustring&string)
static Glib::RefPtr< InetAddress > | create (const guint8* bytes, SocketFamily family)
static Glib::RefPtr< InetAddress > | create_any (SocketFamily family)
static Glib::RefPtr< InetAddress > | create_loopback (SocketFamily family)
## Protected Member Functions
| InetAddress (const guint8* bytes, SocketFamily family)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::InetAddress > | wrap (GInetAddress* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

An IPv4/IPv6 address.

InetAddress represents an IPv4 or IPv6 internet address. Use Resolver::lookup_by_name() or Resolver::lookup_by_name_async() to look up the InetAddress for a hostname. Use Resolver::lookup_by_address() or Resolver::lookup_by_address_async() to look up the hostname for a InetAddress.

To actually connect to a remote host, you will need a InetSocketAddress (which includes a InetAddress as well as a port number).

Since glibmm 2.24:

## Constructor & Destructor Documentation

virtual Gio::InetAddress::~InetAddress | ( |  | ) | `[virtual]`

Gio::InetAddress::InetAddress | ( | const guint8 * | bytes,
|  | SocketFamily | family
| ) |  | `[explicit, protected]`

## Member Function Documentation

static Glib::RefPtr<InetAddress> Gio::InetAddress::create | ( | const Glib::ustring& | string | ) | `[static]`

static Glib::RefPtr<InetAddress> Gio::InetAddress::create | ( | const guint8 * | bytes,
|  | SocketFamily | family
| ) |  | `[static]`

static Glib::RefPtr<InetAddress> Gio::InetAddress::create_any | ( | SocketFamily | family | ) | `[static]`

static Glib::RefPtr<InetAddress> Gio::InetAddress::create_loopback | ( | SocketFamily | family | ) | `[static]`

SocketFamily Gio::InetAddress::get_family | ( |  | ) | const

Gets address's family.

Since glibmm 2.22:

Returns:
  address's family.

bool Gio::InetAddress::get_is_any | ( |  | ) | const

Tests whether address is the "any" address for its family.

Since glibmm 2.22:

Returns:
  `true` if address is the "any" address for its family.

bool Gio::InetAddress::get_is_link_local | ( |  | ) | const

Tests whether address is a link-local address (that is, if it identifies a host on a local network that is not connected to the Internet).

Since glibmm 2.22:

Returns:
  `true` if address is a link-local address.

bool Gio::InetAddress::get_is_loopback | ( |  | ) | const

Tests whether address is the loopback address for its family.

Since glibmm 2.22:

Returns:
  `true` if address is the loopback address for its family.

bool Gio::InetAddress::get_is_mc_global | ( |  | ) | const

Tests whether address is a global multicast address.

Since glibmm 2.22:

Returns:
  `true` if address is a global multicast address.

bool Gio::InetAddress::get_is_mc_link_local | ( |  | ) | const

Tests whether address is a link-local multicast address.

Since glibmm 2.22:

Returns:
  `true` if address is a link-local multicast address.

bool Gio::InetAddress::get_is_mc_node_local | ( |  | ) | const

Tests whether address is a node-local multicast address.

Since glibmm 2.22:

Returns:
  `true` if address is a node-local multicast address.

bool Gio::InetAddress::get_is_mc_org_local | ( |  | ) | const

Tests whether address is an organization-local multicast address.

Since glibmm 2.22:

Returns:
  `true` if address is an organization-local multicast address.

bool Gio::InetAddress::get_is_mc_site_local | ( |  | ) | const

Tests whether address is a site-local multicast address.

Since glibmm 2.22:

Returns:
  `true` if address is a site-local multicast address.

bool Gio::InetAddress::get_is_multicast | ( |  | ) | const

Tests whether address is a multicast address.

Since glibmm 2.22:

Returns:
  `true` if address is a multicast address.

bool Gio::InetAddress::get_is_site_local | ( |  | ) | const

Tests whether address is a site-local address such as 10.0.0.1 (that is, the address identifies a host on a local network that can not be reached directly from the Internet, but which may have outgoing Internet connectivity via a NAT or firewall).

Since glibmm 2.22:

Returns:
  `true` if address is a site-local address.

gsize Gio::InetAddress::get_native_size | ( |  | ) | const

Gets the size of the native raw binary address for address.

This is the size of the data that you get from g_inet_address_to_bytes().

Since glibmm 2.22:

Returns:
  The number of bytes used for the native version of address.

const GInetAddress* Gio::InetAddress::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GInetAddress* Gio::InetAddress::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Glib::ObjectBase.

GInetAddress* Gio::InetAddress::gobj_copy | ( |  | ) |

Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.

Glib::PropertyProxy_ReadOnly<void*> Gio::InetAddress::property_bytes | ( |  | ) | const

The raw address data.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<SocketFamily> Gio::InetAddress::property_family | ( |  | ) | const

The address family (IPv4 or IPv6).

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_any | ( |  | ) | const

Whether this is the 'any' address for its family.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_link_local | ( |  | ) | const

Whether this is a link-local address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_loopback | ( |  | ) | const

Whether this is the loopback address for its family.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_mc_global | ( |  | ) | const

Whether this is a global multicast address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_mc_link_local | ( |  | ) | const

Whether this is a link-local multicast address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_mc_node_local | ( |  | ) | const

Whether this is a node-local multicast address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_mc_org_local | ( |  | ) | const

Whether this is an organization-local multicast address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_mc_site_local | ( |  | ) | const

Whether this is a site-local multicast address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_multicast | ( |  | ) | const

Whether this is a multicast address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

Glib::PropertyProxy_ReadOnly<bool> Gio::InetAddress::property_is_site_local | ( |  | ) | const

Whether this is a site-local address.

You rarely need to use properties because there are get_ and set_ methods for almost all of them.

Returns:
  A PropertyProxy that allows you to get or set the property of the value, or receive notification when the value of the property changes.

const guint8* Gio::InetAddress::to_bytes | ( |  | ) | const

Gets the raw binary address data from address.

Since glibmm 2.22:

Returns:
  A pointer to an internal array of the bytes in address, which should not be modified, stored, or freed. The size of this array can be gotten with g_inet_address_get_native_size().

Glib::ustring Gio::InetAddress::to_string | ( |  | ) | const

Converts address to string form.

Since glibmm 2.22:

Returns:
  A representation of address as a string, which should be freed after use.

## Friends And Related Function Documentation

Glib::RefPtr< Gio::InetAddress > wrap | ( | GInetAddress * | object,
|  | bool | take_copy = `false`
| ) |  | `[related]`

A Glib::wrap() method for this object.

Parameters:

  object | The C instance.
  take_copy | False if the result should take ownership of the C instance. True if it should take a new copy or ref.

Returns:
  A C++ instance that wraps this C instance.