Package ch.bailu.gtk.gio
Klasse SocketConnection
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.IOStream
ch.bailu.gtk.gio.SocketConnection
- Alle implementierten Schnittstellen:
PointerInterface
- Bekannte direkte Unterklassen:
TcpConnection
,UnixConnection
`GSocketConnection` is a [class@Gio.IOStream] for a connected socket. They
can be created either by [class@Gio.SocketClient] when connecting to a host,
or by [class@Gio.SocketListener] when accepting a new client.
The type of the `GSocketConnection` object returned from these calls
depends on the type of the underlying socket that is in use. For
instance, for a TCP/IP connection it will be a [class@Gio.TcpConnection].
Choosing what type of object to construct is done with the socket
connection factory, and it is possible for third parties to register
custom socket connection types for specific combination of socket
family/type/protocol using [func@Gio.SocketConnection.factory_register_type].
To close a `GSocketConnection`, use [method@Gio.IOStream.close]. Closing both
substreams of the [class@Gio.IOStream] separately will not close the
underlying [class@Gio.Socket].
can be created either by [class@Gio.SocketClient] when connecting to a host,
or by [class@Gio.SocketListener] when accepting a new client.
The type of the `GSocketConnection` object returned from these calls
depends on the type of the underlying socket that is in use. For
instance, for a TCP/IP connection it will be a [class@Gio.TcpConnection].
Choosing what type of object to construct is done with the socket
connection factory, and it is possible for third parties to register
custom socket connection types for specific combination of socket
family/type/protocol using [func@Gio.SocketConnection.factory_register_type].
To close a `GSocketConnection`, use [method@Gio.IOStream.close]. Closing both
substreams of the [class@Gio.IOStream] separately will not close the
underlying [class@Gio.Socket].
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenVon Klasse geerbte verschachtelte Klassen/Schnittstellen ch.bailu.gtk.gobject.Object
Object.OnBindingTransformFunc, Object.OnDestroyNotify, Object.OnDuplicateFunc, Object.OnNotify, Object.OnToggleNotify, Object.OnWeakNotify
-
Feldübersicht
Von Klasse geerbte Felder ch.bailu.gtk.gobject.Object
SIGNAL_ON_NOTIFY
-
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungboolean
connect
(SocketAddress address, Cancellable cancellable) Connect @connection to the specified remote address.void
connectAsync
(SocketAddress address, Cancellable cancellable, SocketConnection.OnAsyncReadyCallback callback, Pointer user_data) Asynchronously connect @connection to the specified remote address.boolean
connectFinish
(AsyncResult result) Gets the result of a g_socket_connection_connect_async() call.static long
factoryLookupType
(int family, int type, int protocol_id) Looks up the #GType to be used when creating socket connections on
sockets with the specified @family, @type and @protocol_id.static void
factoryRegisterType
(long g_type, int family, int type, int protocol) Looks up the #GType to be used when creating socket connections on
sockets with the specified @family, @type and @protocol.static ClassHandler
static int
Try to get the local address of a socket connection.static long
static TypeSystem.TypeSize
Try to get the remote address of a socket connection.Gets the underlying #GSocket object of the connection.static long
static TypeSystem.TypeSize
boolean
Checks if @connection is connected.Von Klasse geerbte Methoden ch.bailu.gtk.gio.IOStream
clearPending, close, closeAsync, closeFinish, getInputStream, getOutputStream, hasPending, isClosed, setPending, spliceAsync, spliceFinish
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
-
Konstruktordetails
-
SocketConnection
-
-
Methodendetails
-
getClassHandler
-
connect
public boolean connect(@Nonnull SocketAddress address, @Nullable Cancellable cancellable) throws AllocationError Connect @connection to the specified remote address.- Parameter:
address
- a #GSocketAddress specifying the remote address.cancellable
- a %GCancellable or %NULL- Gibt zurück:
- %TRUE if the connection succeeded, %FALSE on error
- Löst aus:
AllocationError
-
connectAsync
public void connectAsync(@Nonnull SocketAddress address, @Nullable Cancellable cancellable, SocketConnection.OnAsyncReadyCallback callback, @Nullable Pointer user_data) Asynchronously connect @connection to the specified remote address.
This clears the #GSocket:blocking flag on @connection's underlying
socket if it is currently set.
If #GSocket:timeout is set, the operation will time out and return
%G_IO_ERROR_TIMED_OUT after that period. Otherwise, it will continue
indefinitely until operating system timeouts (if any) are hit.
Use g_socket_connection_connect_finish() to retrieve the result.- Parameter:
address
- a #GSocketAddress specifying the remote address.cancellable
- a %GCancellable or %NULLcallback
- a #GAsyncReadyCallbackuser_data
- user data for the callback
-
connectFinish
Gets the result of a g_socket_connection_connect_async() call.- Parameter:
result
- the #GAsyncResult- Gibt zurück:
- %TRUE if the connection succeeded, %FALSE on error
- Löst aus:
AllocationError
-
getLocalAddress
Try to get the local address of a socket connection.- Gibt zurück:
- a #GSocketAddress or %NULL on error. Free the returned object with g_object_unref().
- Löst aus:
AllocationError
-
getRemoteAddress
Try to get the remote address of a socket connection.
Since GLib 2.40, when used with g_socket_client_connect() or
g_socket_client_connect_async(), during emission of
%G_SOCKET_CLIENT_CONNECTING, this function will return the remote
address that will be used for the connection. This allows
applications to print e.g. "Connecting to example.com
(10.42.77.3)...".- Gibt zurück:
- a #GSocketAddress or %NULL on error. Free the returned object with g_object_unref().
- Löst aus:
AllocationError
-
getSocket
Gets the underlying #GSocket object of the connection.
This can be useful if you want to do something unusual on it
not supported by the #GSocketConnection APIs.- Gibt zurück:
- a #GSocket or %NULL on error.
-
isConnected
public boolean isConnected()Checks if @connection is connected. This is equivalent to calling
g_socket_is_connected() on @connection's underlying #GSocket.- Gibt zurück:
- whether @connection is connected
-
factoryLookupType
public static long factoryLookupType(int family, int type, int protocol_id) Looks up the #GType to be used when creating socket connections on
sockets with the specified @family, @type and @protocol_id.
If no type is registered, the #GSocketConnection base type is returned.- Parameter:
family
- a #GSocketFamilytype
- a #GSocketTypeprotocol_id
- a protocol id- Gibt zurück:
- a #GType
-
factoryRegisterType
public static void factoryRegisterType(long g_type, int family, int type, int protocol) Looks up the #GType to be used when creating socket connections on
sockets with the specified @family, @type and @protocol.
If no type is registered, the #GSocketConnection base type is returned.- Parameter:
g_type
- a #GType, inheriting from %G_TYPE_SOCKET_CONNECTIONfamily
- a #GSocketFamilytype
- a #GSocketTypeprotocol
- a protocol id
-
getTypeID
public static long getTypeID() -
getParentTypeID
public static long getParentTypeID() -
getTypeSize
-
getParentTypeSize
-
getInstanceSize
public static int getInstanceSize()
-