ThreadedSocketService
A GThreadedSocketService
is a simple subclass of class@Gio.SocketService that handles incoming connections by creating a worker thread and dispatching the connection to it by emitting the signal@Gio.ThreadedSocketService::run signal in the new thread.
The signal handler may perform blocking I/O and need not return until the connection is closed.
The service is implemented using a thread pool, so there is a limited amount of threads available to serve incoming requests. The service automatically stops the class@Gio.SocketService from accepting new connections when all threads are busy.
As with class@Gio.SocketService, you may connect to signal@Gio.ThreadedSocketService::run, or subclass and override the default handler.
Skipped during bindings generation
method
max-threads
: Property has no getter nor setter
Since
2.22
Constructors
Functions
This is the asynchronous version of g_socket_listener_accept().
This is the asynchronous version of g_socket_listener_accept_socket().
Listens for TCP connections on any available port number for both IPv6 and IPv4 (if each is available).
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.
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.
The ::incoming signal is emitted when a new incoming connection to @service needs to be handled. The handler must initiate the handling of @connection, but may not block; in essence, asynchronous operations must be used.
The ::run signal is emitted in a worker thread in response to an incoming connection. This thread is dedicated to handling
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.