[445:7] extends: object
Generated low-level callback wrapper for GIR callback event.
GSocketListenerEventCallback (callback Fn, UserData = null)
Creates one native callback wrapper. The wrapper owns a trampoline that converts native pointers into generated wrapper objects before invoking
Fn.
Fn is the Aussom callback implementation.UserData is retained and passed through to Fn on each invocation when provided.trampoline (nativeSelf, event, socket, nativeUserData)
Internal trampoline. Converts native pointer arguments into generated wrapper instances, then invokes the user's callback.
callback ()
Returns the wrapped NativeCallback.
handle ()
Returns the callback as a NativeHandle.
close ()
Closes the underlying NativeCallback.
isClosed ()
Returns true when the callback has been closed.
[23:7] extends: object
A GSocketListener is an object that keeps track of a set of server sockets
and helps you accept sockets from any of the socket, either sync or async.
Add addresses and ports to listen on using
[method@Gio.SocketListener.add_address] and
[method@Gio.SocketListener.add_inet_port]. These will be listened on until
[method@Gio.SocketListener.close] is called. Dropping your final reference to
the GSocketListener will not cause [method@Gio.SocketListener.close] to be
called implicitly, as some references to the GSocketListener may be held
internally. If you want to implement a network server, also look at
[class@Gio.SocketService] and [class@Gio.ThreadedSocketService] which are
subclasses of GSocketListener that make this even easier.
GSocketListener (Handle = null)
Creates a new #GSocketListener with no sockets to listen for. New listeners can be added with e.g. g_socket_listener_add_address() or g_socket_listener_add_inet_port().
Handle is an optional native handle or wrapper whose handle to adopt; when the native constructor is called.toNativeHandle (Source)
Normalizes a constructor argument into a raw pointer carrier. Accepts a raw NativeHandle, a raw NativeBuffer returned from
fn.call(...), another generated wrapper exposinghandle(), or null. Returns null when the argument carries no pointer.
Source is the raw handle, raw buffer, wrapper, or null.A raw pointer carrier or null when no pointer is present.getLib ()
Returns the opened native library for this generated wrapper.
The opened native library.handle ()
Returns the wrapped NativeHandle.
The wrapped NativeHandle.isNull ()
Returns true when the wrapped handle is null.
A bool.describe ()
Returns a small string for debugging generated wrappers.
A string.asObject ()
Wraps this handle as
GObject.
A GObject object.connectSignal (string Name, CallbackObj)
Connects one generated callback wrapper to a named signal.
Name is the signal name.CallbackObj is the generated callback wrapper to connect.The connected handler id.disconnectSignalHandler (int HandlerId)
Disconnects one retained signal handler id.
HandlerId is the signal handler id to disconnect.None.setOnEvent (callback Fn, UserData = null)
Emitted when @listener's activity on @socket changes state. Note that when @listener is used to listen on both IPv4 and IPv6, a separate set of signals will be emitted for each, and the order they happen in is undefined.
Fn is the Aussom callback.Fn is called with (GSocketListener Self, string Event, GSocket Socket).UserData is retained and passed through to the generated callback wrapper when provided.The connected handler id.getProperty (string Name)
Reads one generated property by name.
setProperty (string Name, Value)
Writes one generated property by name.
setListenbacklog (int Value)
The number of outstanding connections in the listen queue.
Value is the new property value.None.accept (object cancellable)
Blocks waiting for a client to connect to any of the sockets added to the listener. Returns a #GSocketConnection for the socket that was accepted. If @source_object is not %NULL it will be filled out with the source object specified when the corresponding socket or address was added to the listener. If @cancellable is not %NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.
source_object is location where #GObject pointer will be stored, or %NULL.cancellable is optional #GCancellable object, %NULL to ignore..a #GSocketConnection on success, %NULL on error..accept_async (object cancellable, user_data)
This is the asynchronous version of g_socket_listener_accept(). When the operation is finished @callback will be called. You can then call g_socket_listener_accept_finish() to get the result of the operation.
cancellable is a #GCancellable, or %NULL.callback is a #GAsyncReadyCallback.user_data is user data for the callback.None.accept_finish (object result)
Finishes an async accept operation. See g_socket_listener_accept_async()
result is a #GAsyncResult..source_object is Optional #GObject identifying this source.a #GSocketConnection on success, %NULL on error..accept_socket (object cancellable)
Blocks waiting for a client to connect to any of the sockets added to the listener. Returns the #GSocket that was accepted. If you want to accept the high-level #GSocketConnection, not a #GSocket, which is often the case, then you should use g_socket_listener_accept() instead. If
is not %NULL it will be filled out with the source object specified when the corresponding socket or address was added to the listener. If @cancellable is not %NULL, then the operation can be cancelled by triggering the cancellable object from another thread. If the operation was cancelled, the error %G_IO_ERROR_CANCELLED will be returned.source_object is location where #GObject pointer will be stored, or %NULL..cancellable is optional #GCancellable object, %NULL to ignore..a #GSocket on success, %NULL on error..accept_socket_async (object cancellable, user_data)
This is the asynchronous version of g_socket_listener_accept_socket(). When the operation is finished @callback will be called. You can then call g_socket_listener_accept_socket_finish() to get the result of the operation.
cancellable is a #GCancellable, or %NULL.callback is a #GAsyncReadyCallback.user_data is user data for the callback.None.accept_socket_finish (object result)
Finishes an async accept operation. See g_socket_listener_accept_socket_async()
result is a #GAsyncResult..source_object is Optional #GObject identifying this source.a #GSocket on success, %NULL on error..add_address (object address, string type, string protocol, object source_object)
Creates a socket of type @type and protocol @protocol, binds it to
and adds it to the set of sockets we're accepting sockets from. Note that adding an IPv6 address, depending on the platform, may or may not result in a listener that also accepts IPv4 connections. For more deterministic behavior, see g_socket_listener_add_inet_port().will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to. If successful and @effective_address is non-%NULL then it will be set to the address that the binding actually occurred at. This is helpful for determining the port number that was used for when requesting a binding to port 0 (ie: "any port"). This address, if requested, belongs to the caller and must be freed. Call g_socket_listener_close() to stop listening on @address; this will not be done automatically when you drop your final reference to @listener, as references may be held internally.address is a #GSocketAddress.type is a #GSocketType.protocol is a #GSocketProtocol.source_object is Optional #GObject identifying this source.effective_address is location to store the address that was bound to, or %NULL..%TRUE on success, %FALSE on error..add_any_inet_port (object source_object)
Listens for TCP connections on any available port number for both IPv6 and IPv4 (if each is available). This is useful if you need to have a socket for incoming connections but don't care about the specific port number. If possible, the [class@Gio.SocketListener] will listen on both IPv4 and IPv6 (listening on the same port on both). If listening on one of the socket families fails, the [class@Gio.SocketListener] will only listen on the other. If listening on both fails, an error will be returned. If you need to distinguish whether listening on IPv4 or IPv6 or both was successful, connect to [signal@Gio.SocketListener::event].
will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to.source_object is Optional #GObject identifying this source.the port number, or 0 in case of failure..add_inet_port (int port, object source_object)
Helper function for g_socket_listener_add_address() that creates a TCP/IP socket listening on IPv4 and IPv6 (if supported) on the specified port on all interfaces. If possible, the [class@Gio.SocketListener] will listen on both IPv4 and IPv6 (listening on the same port on both). If listening on one of the socket families fails, the [class@Gio.SocketListener] will only listen on the other. If listening on both fails, an error will be returned. If you need to distinguish whether listening on IPv4 or IPv6 or both was successful, connect to [signal@Gio.SocketListener::event].
will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to. Call g_socket_listener_close() to stop listening on @port; this will not be done automatically when you drop your final reference toas references may be held internally.port is an IP port number (non-zero).source_object is Optional #GObject identifying this source.%TRUE on success, %FALSE on error..add_socket (object socket, object source_object)
Adds @socket to the set of sockets that we try to accept new clients from. The socket must be bound to a local address and listened to. For parallel calls to [class@Gio.SocketListener] methods to work, the socket must be in non-blocking mode. (See [property@Gio.Socket:blocking].)
will be passed out in the various calls to accept to identify this particular source, which is useful if you're listening on multiple addresses and do different things depending on what address is connected to. The @socket will not be automatically closed when theis finalized unless the listener held the final reference to the socket. Before GLib 2.42, the @socket was automatically closed on finalization of the @listener, even if references to it were held elsewhere.socket is a listening #GSocket.source_object is Optional #GObject identifying this source.%TRUE on success, %FALSE on error..close ()
Closes all the sockets in the listener.
None.set_backlog (int listen_backlog)
Sets the listen backlog on the sockets in the listener. This must be called before adding any sockets, addresses or ports to the #GSocketListener (for example, by calling g_socket_listener_add_inet_port()) to be effective. See g_socket_set_listen_backlog() for details
listen_backlog is an integer.None.[517:14] static extends: object
Generated metadata helpers for SocketListener class surfaces.
properties ()
Returns property metadata for
SocketListener.
A list.signals ()
Returns signal metadata for
SocketListener.
A list.