Class ThreadedSocketService

All Implemented Interfaces:
PointerInterface

public class ThreadedSocketService extends SocketService
A #GThreadedSocketService is a simple subclass of #GSocketService
that handles incoming connections by creating a worker thread and
dispatching the connection to it by emitting the
#GThreadedSocketService::run signal in the new thread.

The signal handler may perform blocking IO 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 #GSocketService from accepting
new connections when all threads are busy.

As with #GSocketService, you may connect to #GThreadedSocketService::run,
or subclass and override the default handler.

https://docs.gtk.org/gio/class.ThreadedSocketService.html

  • Field Details

  • Constructor Details

    • ThreadedSocketService

      public ThreadedSocketService(PointerContainer pointer)
    • ThreadedSocketService

      public ThreadedSocketService(int max_threads)
      Creates a new #GThreadedSocketService with no listeners. Listeners
      must be added with one of the #GSocketListener "add" methods.
      Parameters:
      max_threads - the maximal number of threads to execute concurrently handling incoming clients, -1 means no limit
  • Method Details