:right-sidebar: True SocketAddressEnumerator =================================================================== .. currentmodule:: gi.repository.Gio .. class:: SocketAddressEnumerator(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Gio.ProxyAddressEnumerator` ``GSocketAddressEnumerator`` is an enumerator type for :obj:`~gi.repository.Gio.SocketAddress` instances. It is returned by enumeration functions such as :obj:`~gi.repository.Gio.SocketConnectable.enumerate`\, which returns a ``GSocketAddressEnumerator`` to list each :obj:`~gi.repository.Gio.SocketAddress` which could be used to connect to that :obj:`~gi.repository.Gio.SocketConnectable`\. Enumeration is typically a blocking operation, so the asynchronous methods :obj:`~gi.repository.Gio.SocketAddressEnumerator.next_async` and :obj:`~gi.repository.Gio.SocketAddressEnumerator.next_finish` should be used where possible. Each ``GSocketAddressEnumerator`` can only be enumerated once. Once :obj:`~gi.repository.Gio.SocketAddressEnumerator.next` has returned ``NULL``\, further enumeration with that ``GSocketAddressEnumerator`` is not possible, and it can be unreffed. Methods ------- .. rst-class:: interim-class .. class:: SocketAddressEnumerator :no-index: .. method:: do_next(self, cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.SocketAddress | None :param cancellable: .. method:: do_next_async(self, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None :param cancellable: :param callback: :param user_data: .. method:: do_next_finish(self, result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.SocketAddress | None :param result: .. method:: next(cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.SocketAddress | None Retrieves the next :obj:`~gi.repository.Gio.SocketAddress` from ``enumerator``\. Note that this may block for some amount of time. (Eg, a :obj:`~gi.repository.Gio.NetworkAddress` may need to do a DNS lookup before it can return an address.) Use :func:`~gi.repository.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 :func:`~gi.repository.Gio.SocketAddressEnumerator.next` will return an appropriate error in ``error``\. However, if the first call to :func:`~gi.repository.Gio.SocketAddressEnumerator.next` succeeds, then any further internal errors (other than ``cancellable`` being triggered) will be ignored. :param cancellable: optional :obj:`~gi.repository.Gio.Cancellable` object, :const:`None` to ignore. .. method:: next_async(cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously retrieves the next :obj:`~gi.repository.Gio.SocketAddress` from ``enumerator`` and then calls ``callback``\, which must call :func:`~gi.repository.Gio.SocketAddressEnumerator.next_finish` to get the result. It is an error to call this multiple times before the previous callback has finished. :param cancellable: optional :obj:`~gi.repository.Gio.Cancellable` object, :const:`None` to ignore. :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when the request is satisfied :param user_data: the data to pass to callback function .. method:: next_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.SocketAddress | None Retrieves the result of a completed call to :func:`~gi.repository.Gio.SocketAddressEnumerator.next_async`. See :func:`~gi.repository.Gio.SocketAddressEnumerator.next` for more information about error handling. :param result: a :obj:`~gi.repository.Gio.AsyncResult` Virtual Methods --------------- .. rst-class:: interim-class .. class:: SocketAddressEnumerator :no-index: .. method:: do_next(cancellable: ~gi.repository.Gio.Cancellable | None = None) -> ~gi.repository.Gio.SocketAddress | None Retrieves the next :obj:`~gi.repository.Gio.SocketAddress` from ``enumerator``\. Note that this may block for some amount of time. (Eg, a :obj:`~gi.repository.Gio.NetworkAddress` may need to do a DNS lookup before it can return an address.) Use :func:`~gi.repository.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 :func:`~gi.repository.Gio.SocketAddressEnumerator.next` will return an appropriate error in ``error``\. However, if the first call to :func:`~gi.repository.Gio.SocketAddressEnumerator.next` succeeds, then any further internal errors (other than ``cancellable`` being triggered) will be ignored. :param cancellable: optional :obj:`~gi.repository.Gio.Cancellable` object, :const:`None` to ignore. .. method:: do_next_async(cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[~gi.repository.GObject.Object | None, ~gi.repository.Gio.AsyncResult, ~typing.Any], None] | None = None, user_data: ~typing.Any = None) -> None Asynchronously retrieves the next :obj:`~gi.repository.Gio.SocketAddress` from ``enumerator`` and then calls ``callback``\, which must call :func:`~gi.repository.Gio.SocketAddressEnumerator.next_finish` to get the result. It is an error to call this multiple times before the previous callback has finished. :param cancellable: optional :obj:`~gi.repository.Gio.Cancellable` object, :const:`None` to ignore. :param callback: a :obj:`~gi.repository.Gio.AsyncReadyCallback` to call when the request is satisfied :param user_data: the data to pass to callback function .. method:: do_next_finish(result: ~gi.repository.Gio.AsyncResult) -> ~gi.repository.Gio.SocketAddress | None Retrieves the result of a completed call to :func:`~gi.repository.Gio.SocketAddressEnumerator.next_async`. See :func:`~gi.repository.Gio.SocketAddressEnumerator.next` for more information about error handling. :param result: a :obj:`~gi.repository.Gio.AsyncResult` Fields ------ .. rst-class:: interim-class .. class:: SocketAddressEnumerator :no-index: .. attribute:: parent_instance