Class SocketAddressEnumerator
- All Implemented Interfaces:
Proxy
- Direct Known Subclasses:
ProxyAddressEnumerator, SocketAddressEnumerator.SocketAddressEnumerator$Impl
GSocketAddressEnumerator is an enumerator type for
SocketAddress instances. It is returned by enumeration functions
such as SocketConnectable.enumerate(), which returns a
GSocketAddressEnumerator to list each SocketAddress which could
be used to connect to that SocketConnectable.
Enumeration is typically a blocking operation, so the asynchronous methods
nextAsync(Cancellable, AsyncReadyCallback) and
nextFinish(AsyncResult) should be used where
possible.
Each GSocketAddressEnumerator can only be enumerated once. Once
next(Cancellable) has returned NULL, further
enumeration with that GSocketAddressEnumerator is not possible, and it can
be unreffed.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classInner class implementing a builder pattern to construct a GObject with properties.static classThe SocketAddressEnumerator$Impl type represents a native instance of the abstract SocketAddressEnumerator class.static classClass structure forGSocketAddressEnumerator.Nested classes/interfaces inherited from class GObject
GObject.NotifyCallback, GObject.ObjectClass -
Constructor Summary
ConstructorsConstructorDescriptionCreate a new SocketAddressEnumerator.SocketAddressEnumerator(MemorySegment address) Create a SocketAddressEnumerator instance for the provided memory address. -
Method Summary
Modifier and TypeMethodDescriptionprotected SocketAddressEnumeratorasParent()Return this instance as if it were its parent type.static MemoryLayoutThe memory layout of the native struct.static @Nullable TypegetType()Get the GType of the SocketAddressEnumerator class.@Nullable SocketAddressnext(@Nullable Cancellable cancellable) Retrieves the nextGSocketAddressfromenumerator.Note that this may block for some amount of time.voidnextAsync(@Nullable Cancellable cancellable, @Nullable AsyncReadyCallback callback) Asynchronously retrieves the nextGSocketAddressfrom this SocketAddressEnumerator and then callscallback,which must call g_socket_address_enumerator_next_finish() to get the result.@Nullable SocketAddressnextFinish(AsyncResult result) Retrieves the result of a completed call to g_socket_address_enumerator_next_async().Methods inherited from class GObject
addToggleRef, addWeakPointer, bindProperty, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, builder, compatControl, connect, connect, connect, constructed, disconnect, dispatchPropertiesChanged, dispose, dupData, dupQdata, emit, emitNotify, finalize_, forceFloating, freezeNotify, get, getData, getProperty, getProperty, getProperty, getQdata, getv, interfaceFindProperty, interfaceInstallProperty, interfaceListProperties, isFloating, newInstance, newInstance, newv, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, removeWeakPointer, replaceData, replaceQdata, runDispose, set, setData, setDataFull, setProperty, setProperty, setProperty, setQdata, setQdataFull, setv, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref, withPropertiesMethods inherited from class TypeInstance
callParent, callParent, cast, getPrivate, readGClass, writeGClassMethods inherited from class ProxyInstance
equals, handle, hashCode
-
Constructor Details
-
SocketAddressEnumerator
Create a SocketAddressEnumerator instance for the provided memory address.- Parameters:
address- the memory address of the native object
-
SocketAddressEnumerator
public SocketAddressEnumerator()Create a new SocketAddressEnumerator.
-
-
Method Details
-
getType
Get the GType of the SocketAddressEnumerator class.- Returns:
- the GType
-
getMemoryLayout
The memory layout of the native struct.- Returns:
- the memory layout
-
asParent
Return this instance as if it were its parent type. Comparable to the Javasuperkeyword, but ensures the parent typeclass is also used in native code. -
next
Retrieves the next
GSocketAddressfromenumerator.Note that this may block for some amount of time. (Eg, aGNetworkAddressmay 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 this SocketAddressEnumerator 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 thancancellablebeing triggered) will be ignored.- Parameters:
cancellable- optionalGCancellableobject,nullto ignore.- Returns:
- a
GSocketAddress(owned by the caller), ornullon error (in which case*errorwill be set) or if there are no more addresses. - Throws:
GErrorException- seeGError
-
nextAsync
Asynchronously retrieves the next
GSocketAddressfrom this SocketAddressEnumerator and then callscallback,which must call g_socket_address_enumerator_next_finish() to get the result.It is an error to call this multiple times before the previous callback has finished.
- Parameters:
cancellable- optionalGCancellableobject,nullto ignore.callback- aGAsyncReadyCallbackto call when the request is satisfied
-
nextFinish
Retrieves the result of a completed call to g_socket_address_enumerator_next_async(). See g_socket_address_enumerator_next() for more information about error handling.- Parameters:
result- aGAsyncResult- Returns:
- a
GSocketAddress(owned by the caller), ornullon error (in which case*errorwill be set) or if there are no more addresses. - Throws:
GErrorException- seeGError
-