gio.socket_service
Module for SocketService class
Types 3
A gio.socket_service.SocketService is an object that represents a service that is provided to the network or over local sockets. When a new connection is made to the service the gio.socket_service.SocketService.incoming signal is emitted.
A gio.socket_service.SocketService is a subclass of gio.socket_listener.SocketListener and you need to add the addresses you want to accept connections on with the gio.socket_listener.SocketListener APIs.
There are two options for implementing a network service based on gio.socket_service.SocketService. The first is to create the service using gio.socket_service.SocketService.new_ and to connect to the gio.socket_service.SocketService.incoming signal. The second is to subclass gio.socket_service.SocketService and override the default signal handler implementation.
In either case, the handler must immediately return, or else it will block additional incoming connections from being serviced. If you are interested in writing connection handlers that contain blocking code then see gio.threaded_socket_service.ThreadedSocketService.
The socket service runs on the main loop of the thread-default context (see glib.main_context.MainContext.pushThreadDefault) of the thread it is created in, and is not threadsafe in general. However, the calls to start and stop the service are thread-safe so these can be used from threads that handle incoming clients.
SocketService self()Returns `this`, for use in `with` statements.SocketServiceGidBuilder builder()Get builder for [gio.socket_service.SocketService] Returns: New builder objectbool active() @propertyGet `active` property. Returns: Whether the service is currently accepting connections.void active(bool propval) @propertySet `active` property. Params: propval = Whether the service is currently accepting connections.bool isActive()Check whether the service is active or not. An active service will accept new clients that connect, while a non-active service will let connecting clients queue up until the service is started. Ret...void start()Restarts the service, i.e. start accepting connections from the added sockets when the mainloop runs. This only needs to be called after the service has been stopped from [gio.socket_service.Socket...void stop()Stops the service, i.e. stops accepting connections from the added sockets when the mainloop runs.gulong connectIncoming(T)(T callback, Flag!"After" after = No.After) if (isCallable!T
&& is(ReturnType!T == bool)
&& (Parameters!T.length < 1 || (ParameterStorageClassTuple!T[0] == ParameterStorageClass.none && is(Parameters!T[0] : gio.socket_connection.SocketConnection)))
&& (Parameters!T.length < 2 || (ParameterStorageClassTuple!T[1] == ParameterStorageClass.none && is(Parameters!T[1] : gobject.object.ObjectWrap)))
&& (Parameters!T.length < 3 || (ParameterStorageClassTuple!T[2] == ParameterStorageClass.none && is(Parameters!T[2] : gio.socket_service.SocketService)))
&& Parameters!T.length < 4)Connect to `Incoming` signal.Fluent builder implementation template for gio.socket_service.SocketService
T active(bool propval)Set `active` property. Params: propval = Whether the service is currently accepting connections. Returns: Builder instance for fluent chainingFluent builder for gio.socket_service.SocketService
SocketService build()Create object from builder. Returns: New object