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 | Related Functions

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

Abstract base class representing endpoints for socket communication. More...

`#include <giomm/socketaddress.h>`

Inheritance diagram for Gio::SocketAddress:
[legend]

List of all members.

## Public Member Functions
virtual | ~SocketAddress ()
GSocketAddress* | gobj ()
| Provides access to the underlying C GObject.
const GSocketAddress* | gobj () const
| Provides access to the underlying C GObject.
GSocketAddress* | gobj_copy ()
| Provides access to the underlying C instance. The caller is responsible for unrefing it. Use when directly setting fields in structs.
SocketFamily | get_family () const
| Gets the socket family type of address.
bool | to_native (gpointer dest, gsize destlen)
| Converts a SocketAddress to a native <type>struct sockaddr</type>, which can be passed to low-level functions like connect() or bind().
gssize | get_native_size () const
| Gets the size of address's native <type>struct sockaddr</type>.
## Static Public Member Functions
static Glib::RefPtr < SocketAddress > | create (gpointer native, gsize len)
## Related Functions
(Note that these are not member functions.)
Glib::RefPtr< Gio::SocketAddress > | wrap (GSocketAddress* object, bool take_copy=false)
| A Glib::wrap() method for this object.

## Detailed Description

Abstract base class representing endpoints for socket communication.

Since glibmm 2.24:

## Constructor & Destructor Documentation

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

## Member Function Documentation

static Glib::RefPtr<SocketAddress> Gio::SocketAddress::create | ( | gpointer | native,
|  | gsize | len
| ) |  | `[static]`

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

Gets the socket family type of address.

Since glibmm 2.22:

Returns:
  The socket family type of address.

gssize Gio::SocketAddress::get_native_size | ( |  | ) | const

Gets the size of address's native <type>struct sockaddr</type>.

You can use this to allocate memory to pass to g_socket_address_to_native().

Since glibmm 2.22:

Returns:
  The size of the native <type>struct sockaddr</type> that address represents.

GSocketAddress* Gio::SocketAddress::gobj | ( |  | ) | `[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::SocketConnectable.

Reimplemented in Gio::InetSocketAddress, Gio::ProxyAddress, and Gio::UnixSocketAddress.

const GSocketAddress* Gio::SocketAddress::gobj | ( |  | ) | const`[inline]`

Provides access to the underlying C GObject.

Reimplemented from Gio::SocketConnectable.

Reimplemented in Gio::InetSocketAddress, Gio::ProxyAddress, and Gio::UnixSocketAddress.

GSocketAddress* Gio::SocketAddress::gobj_copy | ( |  | ) |

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

Reimplemented in Gio::InetSocketAddress, Gio::ProxyAddress, and Gio::UnixSocketAddress.

bool Gio::SocketAddress::to_native | ( | gpointer | dest,
|  | gsize | destlen
| ) |  |

Converts a SocketAddress to a native <type>struct sockaddr</type>, which can be passed to low-level functions like connect() or bind().

If not enough space is availible, a IO_ERROR_NO_SPACE error is returned. If the address type is not known on the system then a IO_ERROR_NOT_SUPPORTED error is returned.

Since glibmm 2.22:

Parameters:

  dest | A pointer to a memory location that will contain the native <type>struct sockaddr</type>.
  destlen | The size of dest. Must be at least as large as g_socket_address_get_native_size().

Returns:
  `true` if dest was filled in, `false` on error.

## Friends And Related Function Documentation

Glib::RefPtr< Gio::SocketAddress > wrap | ( | GSocketAddress * | 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.