1.79 <GSocketAddressEnumerator>

Class: <GSocketAddressEnumerator>

It derives from <GObject>.

<GSocketAddressEnumerator> is an enumerator type for <GSocketAddress> instances. It is returned by enumeration functions such as socket-connectable:enumerate, which returns a <GSocketAddressEnumerator> to list each <GSocketAddress> which could be used to connect to that <GSocketConnectable>.

Enumeration is typically a blocking operation, so the asynchronous methods socket-address-enumerator:next-async and socket-address-enumerator:next-finish should be used where possible.

Each <GSocketAddressEnumerator> can only be enumerated once. Once socket-address-enumerator:next has returned NULL, further enumeration with that <GSocketAddressEnumerator> is not possible, and it can be unreffed.

Procedures

Method: socket-address-enumerator:next self [cancellable] ⇒ %return
Method: next self [cancellable] ⇒ %return

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

self

Passed: a <GSocketAddressEnumerator>.

a <GSocketAddressEnumerator>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a <GSocketAddress>, or #f.

a <GSocketAddress> (owned by the caller), or #f on error (in which case *error will be set) or if there are no more addresses.

Method: socket-address-enumerator:next-async self [cancellable] [callback]
Method: next-async self [cancellable] [callback]

Asynchronously retrieves the next <GSocketAddress> from self and then calls callback, which must call socket-address-enumerator:next-finish to get the result.

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

self

Passed: a <GSocketAddressEnumerator>.

a <GSocketAddressEnumerator>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Method: socket-address-enumerator:next-finish self result ⇒ %return
Method: next-finish self result ⇒ %return

Retrieves the result of a completed call to socket-address-enumerator:next-async. See socket-address-enumerator:next for more information about error handling.

self

Passed: a <GSocketAddressEnumerator>.

a <GSocketAddressEnumerator>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GSocketAddress>, or #f.

a <GSocketAddress> (owned by the caller), or #f on error (in which case *error will be set) or if there are no more addresses.

Virtual methods

Virtual method: socket-address-enumerator:do-next implementor self [cancellable] ⇒ %return

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

To override it in a new class, give register-type #:vfuncs `((next . ,procedure)). The procedure is called as (procedure self cancellable) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketAddressEnumerator>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketAddressEnumerator>.

a <GSocketAddressEnumerator>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

%return

Returned: a <GSocketAddress>, or #f.

a <GSocketAddress> (owned by the caller), or #f on error (in which case *error will be set) or if there are no more addresses.

Virtual method: socket-address-enumerator:do-next-async implementor self [cancellable] [callback]

Asynchronously retrieves the next <GSocketAddress> from self and then calls callback, which must call socket-address-enumerator:next-finish to get the result.

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

To override it in a new class, give register-type #:vfuncs `((next-async . ,procedure)). The procedure is called as (procedure self cancellable callback user-data).

implementor

Passed: the class whose implementation to call: <GSocketAddressEnumerator>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketAddressEnumerator>.

a <GSocketAddressEnumerator>

cancellable

Passed, or left out: a <GCancellable>, or #f.

optional <GCancellable> object, #f to ignore.

callback

Passed, or left out: a procedure, or #f.

a GAsyncReadyCallback to call when the request is satisfied

See GAsyncReadyCallback for how it is called.

user-data

Not passed: guile-gi supplies it.

the data to pass to callback function

Virtual method: socket-address-enumerator:do-next-finish implementor self result ⇒ %return

Retrieves the result of a completed call to socket-address-enumerator:next-async. See socket-address-enumerator:next for more information about error handling.

To override it in a new class, give register-type #:vfuncs `((next-finish . ,procedure)). The procedure is called as (procedure self result) ⇒ %return.

implementor

Passed: the class whose implementation to call: <GSocketAddressEnumerator>, or a class that derives from it, or its GType number.

self

Passed: a <GSocketAddressEnumerator>.

a <GSocketAddressEnumerator>

result

Passed: a <GAsyncResult>.

a <GAsyncResult>

%return

Returned: a <GSocketAddress>, or #f.

a <GSocketAddress> (owned by the caller), or #f on error (in which case *error will be set) or if there are no more addresses.