Gio.SocketAddressEnumerator¶
- Subclasses:
Methods¶
- Inherited:
- Structs:
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
|
|
|
|
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent_instance |
r |
Class Details¶
- class Gio.SocketAddressEnumerator(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
GSocketAddressEnumerator
is an enumerator type for [class`Gio`.SocketAddress] instances. It is returned by enumeration functions such as [method`Gio`.SocketConnectable.enumerate], which returns aGSocketAddressEnumerator
to list each [class`Gio`.SocketAddress] which could be used to connect to that [iface`Gio`.SocketConnectable].Enumeration is typically a blocking operation, so the asynchronous methods [method`Gio`.SocketAddressEnumerator.next_async] and [method`Gio`.SocketAddressEnumerator.next_finish] should be used where possible.
Each
GSocketAddressEnumerator
can only be enumerated once. Once [method`Gio`.SocketAddressEnumerator.next] has returnedNULL
, further enumeration with thatGSocketAddressEnumerator
is not possible, and it can be unreffed.- next(cancellable)[source]¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.- Raises:
- Returns:
a
Gio.SocketAddress
(owned by the caller), orNone
on error (in which case error will be set) or if there are no more addresses.- Return type:
Retrieves the next
Gio.SocketAddress
from self. Note that this may block for some amount of time. (Eg, aGio.NetworkAddress
may need to do a DNS lookup before it can return an address.) UseGio.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 toGio.SocketAddressEnumerator.next
() succeeds, then any further internal errors (other than cancellable being triggered) will be ignored.
- next_async(cancellable, callback, *user_data)[source]¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously retrieves the next
Gio.SocketAddress
from self and then calls callback, which must callGio.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
) – aGio.AsyncResult
- Raises:
- Returns:
a
Gio.SocketAddress
(owned by the caller), orNone
on error (in which case error will be set) or if there are no more addresses.- Return type:
Retrieves the result of a completed call to
Gio.SocketAddressEnumerator.next_async
(). SeeGio.SocketAddressEnumerator.next
() for more information about error handling.
- do_next(cancellable) virtual¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.- Returns:
a
Gio.SocketAddress
(owned by the caller), orNone
on error (in which case error will be set) or if there are no more addresses.- Return type:
Retrieves the next
Gio.SocketAddress
from enumerator. Note that this may block for some amount of time. (Eg, aGio.NetworkAddress
may need to do a DNS lookup before it can return an address.) UseGio.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 toGio.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:
cancellable (
Gio.Cancellable
orNone
) – optionalGio.Cancellable
object,None
to ignore.callback (
Gio.AsyncReadyCallback
orNone
) – aGio.AsyncReadyCallback
to call when the request is satisfieduser_data (
object
orNone
) – the data to pass to callback function
Asynchronously retrieves the next
Gio.SocketAddress
from enumerator and then calls callback, which must callGio.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
) – aGio.AsyncResult
- Returns:
a
Gio.SocketAddress
(owned by the caller), orNone
on error (in which case error will be set) or if there are no more addresses.- Return type:
Retrieves the result of a completed call to
Gio.SocketAddressEnumerator.next_async
(). SeeGio.SocketAddressEnumerator.next
() for more information about error handling.