next


Description:

public virtual SocketAddress next (Cancellable? cancellable = null) throws Error

Retrieves the next SocketAddress from this .

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

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

Parameters:

this

a SocketAddressEnumerator

cancellable

optional Cancellable object, null to ignore.

Returns:

a SocketAddress (owned by the caller), or null on error (in which case *throws will be set) or if there are no more addresses.