Class: Gio::SocketService
- Inherits:
-
Object
- Object
- Gio::SocketService
- Defined in:
- (unknown)
Overview
Class structure for GSocket::Service.
Instance Method Summary collapse
-
#active=(active) ⇒ TrueClass
Whether the service is currently accepting connections.
-
#active? ⇒ TrueClass
Whether the service is currently accepting connections.
-
#is_active ⇒ TrueClass
Check whether the service is active or not.
-
#new ⇒ Gio::SocketService
Creates a new GSocket::Service with no sockets to listen for.
-
#start ⇒ nil
Restarts the service, i.e.
-
#stop ⇒ nil
Stops the service, i.e.
Instance Method Details
#active=(active) ⇒ TrueClass
Whether the service is currently accepting connections.
#active? ⇒ TrueClass
Whether the service is currently accepting connections.
#is_active ⇒ TrueClass
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.
#new ⇒ Gio::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.
#start ⇒ nil
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.
#stop ⇒ nil
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.