| Copyright | Will Thompson, Iñaki García Etxebarria and Jonas Platte |
|---|---|
| License | LGPL-2.1 |
| Maintainer | Iñaki García Etxebarria (garetxe@gmail.com) |
| Safe Haskell | None |
| Language | Haskell2010 |
GI.Gio.Objects.SocketConnection
Contents
Description
SocketConnection 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 SocketConnection 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 3rd parties to register
custom socket connection types for specific combination of socket
family/type/protocol using socketConnectionFactoryRegisterType.
To close a SocketConnection, use iOStreamClose. Closing both
substreams of the IOStream separately will not close the underlying
Socket.
- newtype SocketConnection = SocketConnection (ManagedPtr SocketConnection)
- class GObject o => IsSocketConnection o
- toSocketConnection :: IsSocketConnection o => o -> IO SocketConnection
- noSocketConnection :: Maybe SocketConnection
- 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, IsSocket a) => a -> IO (GValueConstruct o)
- getSocketConnectionSocket :: (MonadIO m, IsSocketConnection o) => o -> m Socket
- socketConnectionSocket :: AttrLabelProxy "socket"
Exported types
newtype SocketConnection Source #
Constructors
| SocketConnection (ManagedPtr SocketConnection) |
Instances
| GObject SocketConnection Source # | |
| IsObject SocketConnection Source # | |
| IsSocketConnection SocketConnection Source # | |
| IsIOStream SocketConnection Source # | |
| ((~) * info (ResolveSocketConnectionMethod t SocketConnection), MethodInfo * info SocketConnection p) => IsLabel t (SocketConnection -> p) Source # | |
| ((~) * info (ResolveSocketConnectionMethod t SocketConnection), MethodInfo * info SocketConnection p) => IsLabelProxy t (SocketConnection -> p) Source # | |
| HasAttributeList * SocketConnection Source # | |
| type AttributeList SocketConnection Source # | |
| type SignalList SocketConnection Source # | |
class GObject o => IsSocketConnection o Source #
toSocketConnection :: IsSocketConnection o => o -> IO SocketConnection Source #
Methods
connect
data SocketConnectionConnectMethodInfo Source #
Instances
| ((~) * signature (b -> Maybe c -> m ()), MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) => MethodInfo * SocketConnectionConnectMethodInfo a signature Source # | |
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) => MethodInfo * SocketConnectionConnectAsyncMethodInfo a signature Source # | |
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.
Use socketConnectionConnectFinish to retrieve the result.
Since: 2.32
connectFinish
data SocketConnectionConnectFinishMethodInfo Source #
Instances
| ((~) * signature (b -> m ()), MonadIO m, IsSocketConnection a, IsAsyncResult b) => MethodInfo * SocketConnectionConnectFinishMethodInfo a signature Source # | |
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) => MethodInfo * SocketConnectionGetLocalAddressMethodInfo a signature Source # | |
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) => MethodInfo * SocketConnectionGetRemoteAddressMethodInfo a signature Source # | |
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) => MethodInfo * SocketConnectionGetSocketMethodInfo a signature Source # | |
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) => MethodInfo * SocketConnectionIsConnectedMethodInfo a signature Source # | |
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
data SocketConnectionSocketPropertyInfo Source #
Instances
constructSocketConnectionSocket :: (IsSocketConnection o, IsSocket a) => a -> IO (GValueConstruct o) Source #
getSocketConnectionSocket :: (MonadIO m, IsSocketConnection o) => o -> m Socket Source #
socketConnectionSocket :: AttrLabelProxy "socket" Source #