gi-gio
CopyrightWill Thompson and Iñaki García Etxebarria
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria
Safe HaskellNone
LanguageHaskell2010

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

Exported types

newtype SocketConnection Source #

Memory-managed wrapper type.

Instances

Instances details
Eq SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

GObject SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

ManagedPtrNewtype SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

TypedObject SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

Methods

glibType :: IO GType #

HasParentTypes SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

HasAttributeList SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

(info ~ ResolveSocketConnectionMethod t SocketConnection, OverloadedMethod info SocketConnection p, HasField t SocketConnection p) => HasField (t :: Symbol) SocketConnection (p :: Type) Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

Methods

getField :: SocketConnection -> p #

(info ~ ResolveSocketConnectionMethod t SocketConnection, OverloadedMethodInfo info SocketConnection) => IsLabel t (MethodProxy info SocketConnection) Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

(info ~ ResolveSocketConnectionMethod t SocketConnection, OverloadedMethod info SocketConnection p) => IsLabel t (SocketConnection -> p) Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

IsGValue (Maybe SocketConnection) Source #

Convert SocketConnection to and from GValue. See toGValue and fromGValue.

Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttributeList SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type ParentTypes SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type SignalList SocketConnection Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

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

Instances details
(GObject o, IsDescendantOf SocketConnection o) => IsSocketConnection o Source # 
Instance details

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

type family ResolveSocketConnectionMethod (t :: Symbol) o where ... Source #

Equations

ResolveSocketConnectionMethod "bindProperty" o = ObjectBindPropertyMethodInfo 
ResolveSocketConnectionMethod "bindPropertyFull" o = ObjectBindPropertyFullMethodInfo 
ResolveSocketConnectionMethod "clearPending" o = IOStreamClearPendingMethodInfo 
ResolveSocketConnectionMethod "close" o = IOStreamCloseMethodInfo 
ResolveSocketConnectionMethod "closeAsync" o = IOStreamCloseAsyncMethodInfo 
ResolveSocketConnectionMethod "closeFinish" o = IOStreamCloseFinishMethodInfo 
ResolveSocketConnectionMethod "connect" o = SocketConnectionConnectMethodInfo 
ResolveSocketConnectionMethod "connectAsync" o = SocketConnectionConnectAsyncMethodInfo 
ResolveSocketConnectionMethod "connectFinish" o = SocketConnectionConnectFinishMethodInfo 
ResolveSocketConnectionMethod "forceFloating" o = ObjectForceFloatingMethodInfo 
ResolveSocketConnectionMethod "freezeNotify" o = ObjectFreezeNotifyMethodInfo 
ResolveSocketConnectionMethod "getv" o = ObjectGetvMethodInfo 
ResolveSocketConnectionMethod "hasPending" o = IOStreamHasPendingMethodInfo 
ResolveSocketConnectionMethod "isClosed" o = IOStreamIsClosedMethodInfo 
ResolveSocketConnectionMethod "isConnected" o = SocketConnectionIsConnectedMethodInfo 
ResolveSocketConnectionMethod "isFloating" o = ObjectIsFloatingMethodInfo 
ResolveSocketConnectionMethod "notify" o = ObjectNotifyMethodInfo 
ResolveSocketConnectionMethod "notifyByPspec" o = ObjectNotifyByPspecMethodInfo 
ResolveSocketConnectionMethod "ref" o = ObjectRefMethodInfo 
ResolveSocketConnectionMethod "refSink" o = ObjectRefSinkMethodInfo 
ResolveSocketConnectionMethod "runDispose" o = ObjectRunDisposeMethodInfo 
ResolveSocketConnectionMethod "spliceAsync" o = IOStreamSpliceAsyncMethodInfo 
ResolveSocketConnectionMethod "stealData" o = ObjectStealDataMethodInfo 
ResolveSocketConnectionMethod "stealQdata" o = ObjectStealQdataMethodInfo 
ResolveSocketConnectionMethod "thawNotify" o = ObjectThawNotifyMethodInfo 
ResolveSocketConnectionMethod "unref" o = ObjectUnrefMethodInfo 
ResolveSocketConnectionMethod "watchClosure" o = ObjectWatchClosureMethodInfo 
ResolveSocketConnectionMethod "getData" o = ObjectGetDataMethodInfo 
ResolveSocketConnectionMethod "getInputStream" o = IOStreamGetInputStreamMethodInfo 
ResolveSocketConnectionMethod "getLocalAddress" o = SocketConnectionGetLocalAddressMethodInfo 
ResolveSocketConnectionMethod "getOutputStream" o = IOStreamGetOutputStreamMethodInfo 
ResolveSocketConnectionMethod "getProperty" o = ObjectGetPropertyMethodInfo 
ResolveSocketConnectionMethod "getQdata" o = ObjectGetQdataMethodInfo 
ResolveSocketConnectionMethod "getRemoteAddress" o = SocketConnectionGetRemoteAddressMethodInfo 
ResolveSocketConnectionMethod "getSocket" o = SocketConnectionGetSocketMethodInfo 
ResolveSocketConnectionMethod "setData" o = ObjectSetDataMethodInfo 
ResolveSocketConnectionMethod "setDataFull" o = ObjectSetDataFullMethodInfo 
ResolveSocketConnectionMethod "setPending" o = IOStreamSetPendingMethodInfo 
ResolveSocketConnectionMethod "setProperty" o = ObjectSetPropertyMethodInfo 
ResolveSocketConnectionMethod l o = MethodResolutionFailed l o :: Type 

connect

socketConnectionConnect Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) 
=> a

connection: a SocketConnection

-> b

address: a SocketAddress specifying the remote address.

-> Maybe c

cancellable: a GCancellable or Nothing

-> m ()

(Can throw GError)

Connect connection to the specified remote address.

Since: 2.32

connectAsync

socketConnectionConnectAsync Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketConnection a, IsSocketAddress b, IsCancellable c) 
=> a

connection: a SocketConnection

-> b

address: a SocketAddress specifying the remote address.

-> Maybe c

cancellable: a GCancellable or Nothing

-> Maybe AsyncReadyCallback

callback: a 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

socketConnectionConnectFinish Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketConnection a, IsAsyncResult b) 
=> a

connection: a SocketConnection

-> b

result: the AsyncResult

-> m ()

(Can throw GError)

Gets the result of a socketConnectionConnectAsync call.

Since: 2.32

factoryLookupType

socketConnectionFactoryLookupType Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> SocketFamily

family: a SocketFamily

-> SocketType

type: a SocketType

-> Int32

protocolId: a protocol id

-> m GType

Returns: a GType

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

gType: a GType, inheriting from G_TYPE_SOCKET_CONNECTION

-> SocketFamily

family: a SocketFamily

-> SocketType

type: a SocketType

-> Int32

protocol: a protocol id

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

socketConnectionGetLocalAddress Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketConnection a) 
=> a

connection: a SocketConnection

-> m SocketAddress

Returns: a SocketAddress or Nothing on error. Free the returned object with objectUnref. (Can throw GError)

Try to get the local address of a socket connection.

Since: 2.22

getRemoteAddress

socketConnectionGetRemoteAddress Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketConnection a) 
=> a

connection: a SocketConnection

-> m SocketAddress

Returns: a SocketAddress or Nothing on error. Free the returned object with objectUnref. (Can throw GError)

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

socketConnectionGetSocket Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketConnection a) 
=> a

connection: a SocketConnection

-> m Socket

Returns: a Socket or Nothing on error.

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

socketConnectionIsConnected Source #

Arguments

:: (HasCallStack, MonadIO m, IsSocketConnection a) 
=> a

connection: a SocketConnection

-> m Bool

Returns: whether connection is connected

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

Instances details
AttrInfo SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

Associated Types

type AttrAllowedOps SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrBaseTypeConstraint SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrGetType SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrSetTypeConstraint SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrTransferTypeConstraint SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrTransferType SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrLabel SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrOrigin SocketConnectionSocketPropertyInfo 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrAllowedOps SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrBaseTypeConstraint SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrGetType SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrLabel SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrOrigin SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrSetTypeConstraint SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrTransferType SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

type AttrTransferTypeConstraint SocketConnectionSocketPropertyInfo Source # 
Instance details

Defined in GI.Gio.Objects.SocketConnection

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