Class: Gio::SocketService

Inherits:
Object
  • Object
show all
Defined in:
(unknown)

Overview

Class structure for GSocket::Service.

Instance Method Summary collapse

Instance Method Details

#active=(active) ⇒ TrueClass

Whether the service is currently accepting connections.

Parameters:

  • active (TrueClass)

Returns:

  • (TrueClass)

    active

  • (TrueClass)

    active

#active?TrueClass

Whether the service is currently accepting connections.

Returns:

  • (TrueClass)

    active

#is_activeTrueClass

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.

Returns:

  • (TrueClass)

    true if the service is active, false otherwise

#newGio::SocketService

Creates a new GSocket::Service 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().

New services are created active, there is no need to call g_socket_service_start(), unless g_socket_service_stop() has been called before.

Returns:

#startnil

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 g_socket_service_stop().

This call is thread-safe, so it may be called from a thread handling an incoming client request.

Returns:

  • (nil)

#stopnil

Stops the service, i.e. stops accepting connections from the added sockets when the mainloop runs.

This call is thread-safe, so it may be called from a thread handling an incoming client request.

Note that this only stops accepting new connections; it does not close the listening sockets, and you can call g_socket_service_start() again later to begin listening again. To close the listening sockets, call g_socket_listener_close(). (This will happen automatically when the GSocket::Service is finalized.)

This must be called before calling g_socket_listener_close() as the socket service will start accepting connections immediately when a new socket is added.

Returns:

  • (nil)