Gio.SocketAddressEnumerator.next

### Method

# Gio SocketAddressEnumeratornext

#### Declaration

    GSocketAddress*
    g_socket_address_enumerator_next (
      GSocketAddressEnumerator* enumerator,
      GCancellable* cancellable,
      GError** error
    )

#### Description

Retrieves the next `GSocketAddress` from `enumerator`. 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 `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`

  Type: `GCancellable`

  Optional `GCancellable` object, `NULL` to ignore.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

`error`

  Type: `GError **`

  The return location for a recoverable error.

  The argument can be `NULL`.
  If the return location is not `NULL`, then you must initialize it to a `NULL` `GError*`.
  The argument will be left initialized to `NULL` by the method if there are no errors.
  In case of error, the argument will be set to a newly allocated `GError`; the caller will take ownership of the data, and be responsible for freeing it.

#### Return value

Type: `GSocketAddress`

A `GSocketAddress` (owned by the caller), or `NULL` on error (in which case *`error` will be set) or if there are no more addresses.

The caller of the method takes ownership of the data, and is responsible for freeing it.
The return value can be `NULL`.