Class: Gio::SocketAddressEnumerator

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

Class structure for GSocket::AddressEnumerator.

Instance Method Summary collapse

Instance Method Details

#next(cancellable) ⇒ Gio::SocketAddress

Retrieves the next GSocket::Address from enumerator. Note that this may block for some amount of time. (Eg, a GNetwork::Address may need to do a DNS lookup before it can return an address.) Use g_socket_address_enumerator_next_async() if you need to avoid blocking.

If enumerator is expected to yield addresses, but for some reason is unable to (eg, because of a DNS error), then the first call to g_socket_address_enumerator_next() will return an appropriate error in *error. However, if the first call to g_socket_address_enumerator_next() succeeds, then any further internal errors (other than cancellable being triggered) will be ignored.

Parameters:

  • cancellable (Gio::Cancellable)

    optional #GCancellable object, nil to ignore.

Returns:

  • (Gio::SocketAddress)

    a GSocket::Address (owned by the caller), or nil on error (in which case *error will be set) or if there are no more addresses.

#next_async(cancellable, callback, user_data) ⇒ nil

Asynchronously retrieves the next GSocket::Address from enumerator and then calls callback, which must call g_socket_address_enumerator_next_finish() to get the result.

It is an error to call this multiple times before the previous callback has finished.

Parameters:

  • cancellable (Gio::Cancellable)

    optional #GCancellable object, nil to ignore.

  • callback (Gio::AsyncReadyCallback)

    a GAsync::ReadyCallback to call when the request is satisfied

  • user_data (GObject)

    the data to pass to callback function

Returns:

  • (nil)

#next_finish(result) ⇒ Gio::SocketAddress

Retrieves the result of a completed call to g_socket_address_enumerator_next_async(). See g_socket_address_enumerator_next() for more information about error handling.

Parameters:

Returns:

  • (Gio::SocketAddress)

    a GSocket::Address (owned by the caller), or nil on error (in which case *error will be set) or if there are no more addresses.