Class: Gio::SocketService
- Inherits:
-
SocketListener
- Object
- SocketListener
- Gio::SocketService
- Defined in:
- (unknown)
Overview
Class structure for GSocket::Service.
Direct Known Subclasses
Instance Method Summary collapse
-
#active=(active) ⇒ Boolean
Whether the service is currently accepting connections.
-
#active? ⇒ Boolean
Whether the service is currently accepting connections.
-
#initialize ⇒ Gio::SocketService
constructor
Creates a new GSocket::Service with no sockets to listen for.
-
#is_active ⇒ Boolean
Check whether the service is active or not.
-
#start ⇒ nil
Restarts the service, i.e.
-
#stop ⇒ nil
Stops the service, i.e.
Methods inherited from SocketListener
#accept, #accept_async, #accept_finish, #accept_socket, #accept_socket_async, #accept_socket_finish, #add_address, #add_any_inet_port, #add_inet_port, #add_socket, #backlog=, #close, #listen_backlog, #listen_backlog=
Constructor Details
#initialize ⇒ 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.
Instance Method Details
#active=(active) ⇒ Boolean
Whether the service is currently accepting connections.
#active? ⇒ Boolean
Whether the service is currently accepting connections.
#is_active ⇒ Boolean
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.
#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.