gi-gio-2.0.38: Gio bindings

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.TcpConnection

Contents

- Exported types
- Methods
  - getGracefulDisconnect
  - setGracefulDisconnect
- Properties
  - gracefulDisconnect

Description

This is the subclass of `SocketConnection` that is created for TCP/IP sockets.

Since: 2.22

Synopsis

- newtype TcpConnection = TcpConnection (ManagedPtr TcpConnection)
- class (GObject o, IsDescendantOf TcpConnection o) => IsTcpConnection o
- toTcpConnection :: (MonadIO m, IsTcpConnection o) => o -> m TcpConnection
- tcpConnectionGetGracefulDisconnect :: (HasCallStack, MonadIO m, IsTcpConnection a) => a -> m Bool
- tcpConnectionSetGracefulDisconnect :: (HasCallStack, MonadIO m, IsTcpConnection a) => a -> Bool -> m ()
- constructTcpConnectionGracefulDisconnect :: (IsTcpConnection o, MonadIO m) => Bool -> m (GValueConstruct o)
- getTcpConnectionGracefulDisconnect :: (MonadIO m, IsTcpConnection o) => o -> m Bool
- setTcpConnectionGracefulDisconnect :: (MonadIO m, IsTcpConnection o) => o -> Bool -> m ()

# Exported types

newtype TcpConnection Source #

Memory-managed wrapper type.

Constructors

TcpConnection (ManagedPtr TcpConnection) |

#### Instances

Instances details

Eq TcpConnection Source # |
Instance details Defined in GI.Gio.Objects.TcpConnection Methods (==) :: TcpConnection -> TcpConnection -> Bool Source # (/=) :: TcpConnection -> TcpConnection -> Bool Source #
GObject TcpConnection Source # |
Instance details Defined in GI.Gio.Objects.TcpConnection
ManagedPtrNewtype TcpConnection Source # |
Instance details Defined in GI.Gio.Objects.TcpConnection Methods toManagedPtr :: TcpConnection -> ManagedPtr TcpConnection Source #
TypedObject TcpConnection Source # |
Instance details Defined in GI.Gio.Objects.TcpConnection Methods glibType :: IO GType Source #
HasParentTypes TcpConnection Source # |
Instance details Defined in GI.Gio.Objects.TcpConnection
IsGValue (Maybe TcpConnection) Source # | Convert `TcpConnection` to and from `GValue`. See `toGValue` and `fromGValue`.
Instance details Defined in GI.Gio.Objects.TcpConnection Methods gvalueGType_ :: IO GType Source # gvalueSet_ :: Ptr GValue -> Maybe TcpConnection -> IO () Source # gvalueGet_ :: Ptr GValue -> IO (Maybe TcpConnection) Source #
type ParentTypes TcpConnection Source # |
Instance details Defined in GI.Gio.Objects.TcpConnection type ParentTypes TcpConnection = '[SocketConnection, IOStream, Object]

class (GObject o, IsDescendantOf TcpConnection o) => IsTcpConnection o Source #

Type class for types which can be safely cast to `TcpConnection`, for instance with `toTcpConnection`.

#### Instances

Instances details

(GObject o, IsDescendantOf TcpConnection o) => IsTcpConnection o Source # |
Instance details Defined in GI.Gio.Objects.TcpConnection

toTcpConnection :: (MonadIO m, IsTcpConnection o) => o -> m TcpConnection Source #

Cast to `TcpConnection`, 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

Expand

#### 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, getGracefulDisconnect, getInputStream, getLocalAddress, getOutputStream, getProperty, getQdata, getRemoteAddress, getSocket.

#### Setters

setData, setDataFull, setGracefulDisconnect, setPending, setProperty.

## getGracefulDisconnect

tcpConnectionGetGracefulDisconnect Source #

Arguments

:: (HasCallStack, MonadIO m, IsTcpConnection a) |
=> a | `connection`: a `TcpConnection`
-> m Bool | Returns: `True` if graceful disconnect is used on close, `False` otherwise

Checks if graceful disconnects are used. See `tcpConnectionSetGracefulDisconnect`.

Since: 2.22

## setGracefulDisconnect

tcpConnectionSetGracefulDisconnect Source #

Arguments

:: (HasCallStack, MonadIO m, IsTcpConnection a) |
=> a | `connection`: a `TcpConnection`
-> Bool | `gracefulDisconnect`: Whether to do graceful disconnects or not
-> m () |

This enables graceful disconnects on close. A graceful disconnect means that we signal the receiving end that the connection is terminated and wait for it to close the connection before closing the connection.

A graceful disconnect means that we can be sure that we successfully sent all the outstanding data to the other end, or get an error reported. However, it also means we have to wait for all the data to reach the other side and for it to acknowledge this by closing the socket, which may take a while. For this reason it is disabled by default.

Since: 2.22

# Properties

## gracefulDisconnect

Whether `iOStreamClose` does a graceful disconnect.

Since: 2.22

constructTcpConnectionGracefulDisconnect :: (IsTcpConnection o, MonadIO m) => Bool -> m (GValueConstruct o) Source #

Construct a `GValueConstruct` with valid value for the “`graceful-disconnect`” property. This is rarely needed directly, but it is used by `new`.

getTcpConnectionGracefulDisconnect :: (MonadIO m, IsTcpConnection o) => o -> m Bool Source #

Get the value of the “`graceful-disconnect`” property. When overloading is enabled, this is equivalent to

    get tcpConnection #gracefulDisconnect

setTcpConnectionGracefulDisconnect :: (MonadIO m, IsTcpConnection o) => o -> Bool -> m () Source #

Set the value of the “`graceful-disconnect`” property. When overloading is enabled, this is equivalent to

    set tcpConnection [ #gracefulDisconnect := value ]