Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | None |
Language | Haskell2010 |
GI.Gio.Objects.SocketConnection
Description
GSocketConnection
is a IOStream
for a connected socket. They
can be created either by SocketClient
when connecting to a host,
or by 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 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 socketConnectionFactoryRegisterType
.
To close a GSocketConnection
, use iOStreamClose
. Closing both
substreams of the IOStream
separately will not close the
underlying Socket
.
Since: 2.22
Synopsis
- newtype SocketConnection = SocketConnection (ManagedPtr SocketConnection)
- class (GObject o, IsDescendantOf SocketConnection o) => IsSocketConnection o
- toSocketConnection :: (MonadIO m, IsSocketConnection o) => o -> m SocketConnection
- type family ResolveSocketConnectionMethod (t :: Symbol) o where ...
- data SocketConnectionConnectMethodInfo
- socketConnectionConnect :: (HasCallStack, MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) => a -> b -> Maybe c -> m ()
- data SocketConnectionConnectAsyncMethodInfo
- socketConnectionConnectAsync :: (HasCallStack, MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) => a -> b -> Maybe c -> Maybe AsyncReadyCallback -> m ()
- data SocketConnectionConnectFinishMethodInfo
- socketConnectionConnectFinish :: (HasCallStack, MonadIO m, IsSocketConnection a, IsAsyncResult b) => a -> b -> m ()
- socketConnectionFactoryLookupType :: (HasCallStack, MonadIO m) => SocketFamily -> SocketType -> Int32 -> m GType
- socketConnectionFactoryRegisterType :: (HasCallStack, MonadIO m) => GType -> SocketFamily -> SocketType -> Int32 -> m ()
- data SocketConnectionGetLocalAddressMethodInfo
- socketConnectionGetLocalAddress :: (HasCallStack, MonadIO m, IsSocketConnection a) => a -> m SocketAddress
- data SocketConnectionGetRemoteAddressMethodInfo
- socketConnectionGetRemoteAddress :: (HasCallStack, MonadIO m, IsSocketConnection a) => a -> m SocketAddress
- data SocketConnectionGetSocketMethodInfo
- socketConnectionGetSocket :: (HasCallStack, MonadIO m, IsSocketConnection a) => a -> m Socket
- data SocketConnectionIsConnectedMethodInfo
- socketConnectionIsConnected :: (HasCallStack, MonadIO m, IsSocketConnection a) => a -> m Bool
- data SocketConnectionSocketPropertyInfo
- constructSocketConnectionSocket :: (IsSocketConnection o, MonadIO m, IsSocket a) => a -> m (GValueConstruct o)
- getSocketConnectionSocket :: (MonadIO m, IsSocketConnection o) => o -> m Socket
- socketConnectionSocket :: AttrLabelProxy "socket"
Exported types
newtype SocketConnection Source #
Memory-managed wrapper type.
Constructors
SocketConnection (ManagedPtr SocketConnection) |
Instances
class (GObject o, IsDescendantOf SocketConnection o) => IsSocketConnection o Source #
Type class for types which can be safely cast to SocketConnection
, for instance with toSocketConnection
.
Instances
(GObject o, IsDescendantOf SocketConnection o) => IsSocketConnection o Source # | |
Defined in GI.Gio.Objects.SocketConnection |
toSocketConnection :: (MonadIO m, IsSocketConnection o) => o -> m SocketConnection Source #
Cast to SocketConnection
, for types for which this is known to be safe. For general casts, use castTo
.
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, clearPending, close, closeAsync, closeFinish, connect, connectAsync, connectFinish, forceFloating, freezeNotify, getv, hasPending, isClosed, isConnected, isFloating, notify, notifyByPspec, ref, refSink, runDispose, spliceAsync, stealData, stealQdata, thawNotify, unref, watchClosure.
Getters
getData, getInputStream, getLocalAddress, getOutputStream, getProperty, getQdata, getRemoteAddress, getSocket.
Setters
type family ResolveSocketConnectionMethod (t :: Symbol) o where ... Source #
Equations
connect
data SocketConnectionConnectMethodInfo Source #
Instances
(signature ~ (b -> Maybe c -> m ()), MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) => OverloadedMethod SocketConnectionConnectMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionConnectMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods |
socketConnectionConnect Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> m () | (Can throw |
Connect connection
to the specified remote address.
Since: 2.32
connectAsync
data SocketConnectionConnectAsyncMethodInfo Source #
Instances
(signature ~ (b -> Maybe c -> Maybe AsyncReadyCallback -> m ()), MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) => OverloadedMethod SocketConnectionConnectAsyncMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionConnectAsyncMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods |
socketConnectionConnectAsync Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) | |
=> a |
|
-> b |
|
-> Maybe c |
|
-> Maybe AsyncReadyCallback |
|
-> m () |
Asynchronously connect connection
to the specified remote address.
This clears the Socket:blocking flag on connection
's underlying
socket if it is currently set.
If Socket:timeout is set, the operation will time out and return
IOErrorEnumTimedOut
after that period. Otherwise, it will continue
indefinitely until operating system timeouts (if any) are hit.
Use socketConnectionConnectFinish
to retrieve the result.
Since: 2.32
connectFinish
data SocketConnectionConnectFinishMethodInfo Source #
Instances
(signature ~ (b -> m ()), MonadIO m, IsSocketConnection a, IsAsyncResult b) => OverloadedMethod SocketConnectionConnectFinishMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionConnectFinishMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods |
socketConnectionConnectFinish Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketConnection a, IsAsyncResult b) | |
=> a |
|
-> b |
|
-> m () | (Can throw |
Gets the result of a socketConnectionConnectAsync
call.
Since: 2.32
factoryLookupType
socketConnectionFactoryLookupType Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> SocketFamily |
|
-> SocketType |
|
-> Int32 |
|
-> m GType | Returns: a |
Looks up the GType
to be used when creating socket connections on
sockets with the specified family
, type
and protocolId
.
If no type is registered, the SocketConnection
base type is returned.
Since: 2.22
factoryRegisterType
socketConnectionFactoryRegisterType Source #
Arguments
:: (HasCallStack, MonadIO m) | |
=> GType |
|
-> SocketFamily |
|
-> SocketType |
|
-> Int32 |
|
-> m () |
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 SocketConnection
base type is returned.
Since: 2.22
getLocalAddress
data SocketConnectionGetLocalAddressMethodInfo Source #
Instances
(signature ~ m SocketAddress, MonadIO m, IsSocketConnection a) => OverloadedMethod SocketConnectionGetLocalAddressMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionGetLocalAddressMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods |
socketConnectionGetLocalAddress Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketConnection a) | |
=> a |
|
-> m SocketAddress | Returns: a |
Try to get the local address of a socket connection.
Since: 2.22
getRemoteAddress
data SocketConnectionGetRemoteAddressMethodInfo Source #
Instances
(signature ~ m SocketAddress, MonadIO m, IsSocketConnection a) => OverloadedMethod SocketConnectionGetRemoteAddressMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionGetRemoteAddressMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods |
socketConnectionGetRemoteAddress Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketConnection a) | |
=> a |
|
-> m SocketAddress | Returns: a |
Try to get the remote address of a socket connection.
Since GLib 2.40, when used with socketClientConnect
or
socketClientConnectAsync
, during emission of
SocketClientEventConnecting
, 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)...".
Since: 2.22
getSocket
data SocketConnectionGetSocketMethodInfo Source #
Instances
(signature ~ m Socket, MonadIO m, IsSocketConnection a) => OverloadedMethod SocketConnectionGetSocketMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionGetSocketMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods |
socketConnectionGetSocket Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketConnection a) | |
=> a |
|
-> m Socket |
Gets the underlying Socket
object of the connection.
This can be useful if you want to do something unusual on it
not supported by the SocketConnection
APIs.
Since: 2.22
isConnected
data SocketConnectionIsConnectedMethodInfo Source #
Instances
(signature ~ m Bool, MonadIO m, IsSocketConnection a) => OverloadedMethod SocketConnectionIsConnectedMethodInfo a signature Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods overloadedMethod :: a -> signature # | |
OverloadedMethodInfo SocketConnectionIsConnectedMethodInfo (a :: Type) Source # | |
Defined in GI.Gio.Objects.SocketConnection Methods |
socketConnectionIsConnected Source #
Arguments
:: (HasCallStack, MonadIO m, IsSocketConnection a) | |
=> a |
|
-> m Bool | Returns: whether |
Checks if connection
is connected. This is equivalent to calling
socketIsConnected
on connection
's underlying Socket
.
Since: 2.32
Properties
socket
The underlying Socket
.
Since: 2.22
data SocketConnectionSocketPropertyInfo Source #
Instances
constructSocketConnectionSocket :: (IsSocketConnection o, MonadIO m, IsSocket a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “socket
” property. This is rarely needed directly, but it is used by new
.
getSocketConnectionSocket :: (MonadIO m, IsSocketConnection o) => o -> m Socket Source #
Get the value of the “socket
” property.
When overloading is enabled, this is equivalent to
get
socketConnection #socket
socketConnectionSocket :: AttrLabelProxy "socket" Source #