Gio.SocketAddressEnumerator

g GObject.Object GObject.Object Gio.SocketAddressEnumerator Gio.SocketAddressEnumerator GObject.Object->Gio.SocketAddressEnumerator

Subclasses:Gio.ProxyAddressEnumerator

Methods

Inherited:GObject.Object (37)
Structs:GObject.ObjectClass (5)
  next (cancellable)
  next_async (cancellable, callback, *user_data)
  next_finish (result)

Virtual Methods

Inherited:GObject.Object (7)
  do_next (cancellable)
  do_next_async (cancellable, callback, *user_data)
  do_next_finish (result)

Properties

None

Signals

Inherited:GObject.Object (1)

Fields

Inherited:GObject.Object (1)
Name Type Access Description
parent_instance GObject.Object r  

Class Details

class Gio.SocketAddressEnumerator(**kwargs)
Bases:GObject.Object
Abstract:Yes
Structure:Gio.SocketAddressEnumeratorClass

Gio.SocketAddressEnumerator is an enumerator type for Gio.SocketAddress instances. It is returned by enumeration functions such as Gio.SocketConnectable.enumerate(), which returns a Gio.SocketAddressEnumerator to list each Gio.SocketAddress which could be used to connect to that Gio.SocketConnectable.

Enumeration is typically a blocking operation, so the asynchronous methods Gio.SocketAddressEnumerator.next_async() and Gio.SocketAddressEnumerator.next_finish() should be used where possible.

Each Gio.SocketAddressEnumerator can only be enumerated once. Once Gio.SocketAddressEnumerator.next() has returned None, further enumeration with that Gio.SocketAddressEnumerator is not possible, and it can be unreffed.

next(cancellable)[source]
Parameters:cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, None to ignore.
Raises:GLib.Error
Returns:a Gio.SocketAddress (owned by the caller), or None on error (in which case error will be set) or if there are no more addresses.
Return type:Gio.SocketAddress

Retrieves the next Gio.SocketAddress from self. Note that this may block for some amount of time. (Eg, a Gio.NetworkAddress may need to do a DNS lookup before it can return an address.) Use Gio.SocketAddressEnumerator.next_async() if you need to avoid blocking.

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

next_async(cancellable, callback, *user_data)[source]
Parameters:

Asynchronously retrieves the next Gio.SocketAddress from self and then calls callback, which must call Gio.SocketAddressEnumerator.next_finish() to get the result.

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

next_finish(result)[source]
Parameters:result (Gio.AsyncResult) – a Gio.AsyncResult
Raises:GLib.Error
Returns:a Gio.SocketAddress (owned by the caller), or None on error (in which case error will be set) or if there are no more addresses.
Return type:Gio.SocketAddress

Retrieves the result of a completed call to Gio.SocketAddressEnumerator.next_async(). See Gio.SocketAddressEnumerator.next() for more information about error handling.

do_next(cancellable) virtual
Parameters:cancellable (Gio.Cancellable or None) – optional Gio.Cancellable object, None to ignore.
Returns:a Gio.SocketAddress (owned by the caller), or None on error (in which case error will be set) or if there are no more addresses.
Return type:Gio.SocketAddress

Retrieves the next Gio.SocketAddress from enumerator. Note that this may block for some amount of time. (Eg, a Gio.NetworkAddress may need to do a DNS lookup before it can return an address.) Use Gio.SocketAddressEnumerator.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 Gio.SocketAddressEnumerator.next() will return an appropriate error in error. However, if the first call to Gio.SocketAddressEnumerator.next() succeeds, then any further internal errors (other than cancellable being triggered) will be ignored.

do_next_async(cancellable, callback, *user_data) virtual
Parameters:

Asynchronously retrieves the next Gio.SocketAddress from enumerator and then calls callback, which must call Gio.SocketAddressEnumerator.next_finish() to get the result.

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

do_next_finish(result) virtual
Parameters:result (Gio.AsyncResult) – a Gio.AsyncResult
Returns:a Gio.SocketAddress (owned by the caller), or None on error (in which case error will be set) or if there are no more addresses.
Return type:Gio.SocketAddress

Retrieves the result of a completed call to Gio.SocketAddressEnumerator.next_async(). See Gio.SocketAddressEnumerator.next() for more information about error handling.