Package ch.bailu.gtk.gio
Klasse SocketService
java.lang.Object
ch.bailu.gtk.type.Type
ch.bailu.gtk.type.Pointer
ch.bailu.gtk.gobject.Object
ch.bailu.gtk.type.PropertyHolder
ch.bailu.gtk.gio.SocketListener
ch.bailu.gtk.gio.SocketService
- Alle implementierten Schnittstellen:
PointerInterface
- Bekannte direkte Unterklassen:
ThreadedSocketService
A `GSocketService` is an object that represents a service that
is provided to the network or over local sockets. When a new
connection is made to the service the [signal@Gio.SocketService::incoming]
signal is emitted.
A `GSocketService` is a subclass of [class@Gio.SocketListener] and you need
to add the addresses you want to accept connections on with the
[class@Gio.SocketListener] APIs.
There are two options for implementing a network service based on
`GSocketService`. The first is to create the service using
[ctor@Gio.SocketService.new] and to connect to the
[signal@Gio.SocketService::incoming] signal. The second is to subclass
`GSocketService` and override the default signal handler implementation.
In either case, the handler must immediately return, or else it
will block additional incoming connections from being serviced.
If you are interested in writing connection handlers that contain
blocking code then see [class@Gio.ThreadedSocketService].
The socket service runs on the main loop of the
thread-default context (see
[method@GLib.MainContext.push_thread_default]) of the thread it is
created in, and is not threadsafe in general. However, the calls to start and
stop the service are thread-safe so these can be used from threads that
handle incoming clients.
is provided to the network or over local sockets. When a new
connection is made to the service the [signal@Gio.SocketService::incoming]
signal is emitted.
A `GSocketService` is a subclass of [class@Gio.SocketListener] and you need
to add the addresses you want to accept connections on with the
[class@Gio.SocketListener] APIs.
There are two options for implementing a network service based on
`GSocketService`. The first is to create the service using
[ctor@Gio.SocketService.new] and to connect to the
[signal@Gio.SocketService::incoming] signal. The second is to subclass
`GSocketService` and override the default signal handler implementation.
In either case, the handler must immediately return, or else it
will block additional incoming connections from being serviced.
If you are interested in writing connection handlers that contain
blocking code then see [class@Gio.ThreadedSocketService].
The socket service runs on the main loop of the
thread-default context (see
[method@GLib.MainContext.push_thread_default]) of the thread it is
created in, and is not threadsafe in general. However, the calls to start and
stop the service are thread-safe so these can be used from threads that
handle incoming clients.
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenVon Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gio.SocketListener
SocketListener.OnAsyncReadyCallback, SocketListener.OnEvent
Von Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
FelderVon Klasse geerbte Felder ch.bailu.gtk.gio.SocketListener
SIGNAL_ON_EVENT
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
KonstruktorenKonstruktorBeschreibungCreates a new #GSocketService with no sockets to listen for.SocketService
(PointerContainer pointer) -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungstatic ClassHandler
static int
static long
static TypeSystem.TypeSize
static long
static TypeSystem.TypeSize
boolean
isActive()
Check whether the service is active or not.onIncoming
(SocketService.OnIncoming signal) Connect to signal "incoming".void
start()
Restarts the service, i.e. start accepting connections
from the added sockets when the mainloop runs.void
stop()
Stops the service, i.e. stops accepting connections
from the added sockets when the mainloop runs.Von Klasse geerbte Methoden ch.bailu.gtk.gio.SocketListener
acceptAsync, acceptSocketAsync, addAnyInetPort, addInetPort, addSocket, close, onEvent, setBacklog
Von Klasse geerbte Methoden ch.bailu.gtk.type.PropertyHolder
getBooleanProperty, getIntProperty, getObjectProperty, getStringProperty, getStrProperty, setBooleanProperty, setIntProperty, setObjectProperty, setStringProperty, setStrProperty
Von Klasse geerbte Methoden ch.bailu.gtk.gobject.Object
addToggleRef, bindProperty, bindProperty, bindPropertyFull, bindPropertyFull, bindPropertyWithClosures, bindPropertyWithClosures, compatControl, connect, connect, disconnect, disconnect, dupData, dupData, dupQdata, forceFloating, freezeNotify, get, get, getData, getData, getProperty, getProperty, getQdata, interfaceFindProperty, interfaceInstallProperty, isFloating, notify, notify, notifyByPspec, onNotify, ref, refSink, removeToggleRef, replaceData, replaceData, replaceQdata, runDispose, set, set, setData, setData, setDataFull, setDataFull, setProperty, setProperty, setQdata, setQdataFull, stealData, stealData, stealQdata, takeRef, thawNotify, unref, watchClosure, weakRef, weakUnref
Von Klasse geerbte Methoden ch.bailu.gtk.type.Pointer
asCPointer, cast, connectSignal, disconnectSignals, disconnectSignals, equals, hashCode, throwIfNull, throwNullPointerException, toString, unregisterCallbacks, unregisterCallbacks
Von Klasse geerbte Methoden ch.bailu.gtk.type.Type
asCPointer, asCPointer, asCPointerNotNull, asJnaPointer, asJnaPointer, asPointer, asPointer, cast, cast, throwIfNull
Von Klasse geerbte Methoden java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
Von Schnittstelle geerbte Methoden ch.bailu.gtk.type.PointerInterface
asCPointerNotNull, asJnaPointer, asPointer, isNotNull, isNull
-
Felddetails
-
SIGNAL_ON_INCOMING
- Siehe auch:
-
-
Konstruktordetails
-
SocketService
-
SocketService
public SocketService()Creates a new #GSocketService 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.
-
-
Methodendetails
-
getClassHandler
-
isActive
public boolean isActive()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.- Gibt zurück:
- %TRUE if the service is active, %FALSE otherwise
-
start
public void start()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
public void stop()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 #GSocketService 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. -
onIncoming
Connect to signal "incoming".
SeeSocketService.OnIncoming.onIncoming(ch.bailu.gtk.gio.SocketConnection, ch.bailu.gtk.gobject.Object)
for signal description.
FieldSIGNAL_ON_INCOMING
contains original signal name and can be used as resource reference.- Parameter:
signal
- callback function (lambda).- Gibt zurück:
SignalHandler
. Can be used to disconnect signal and to release callback function.
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-