Copyright | Will Thompson and Iñaki García Etxebarria |
---|---|
License | LGPL-2.1 |
Maintainer | Iñaki García Etxebarria |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
No description available in the introspection data.
Synopsis
- newtype Socket = Socket (ManagedPtr Socket)
- class (GObject o, IsDescendantOf Socket o) => IsSocket o
- toSocket :: (MonadIO m, IsSocket o) => o -> m Socket
- socketConnectAsync :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> Maybe b -> SocketCallback -> m ()
- socketConnectSync :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> Maybe b -> m Word32
- socketDisconnect :: (HasCallStack, MonadIO m, IsSocket a) => a -> m ()
- socketGetFd :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Int32
- socketGetLocalAddress :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Address
- socketGetRemoteAddress :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Address
- socketIsConnected :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- socketIsSsl :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- socketListen :: (HasCallStack, MonadIO m, IsSocket a) => a -> m Bool
- socketRead :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Maybe b -> m (SocketIOStatus, Word64)
- socketReadUntil :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Ptr () -> Word64 -> Maybe b -> m (SocketIOStatus, Word64, Bool)
- socketStartProxySsl :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> Text -> Maybe b -> m Bool
- socketStartSsl :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> Maybe b -> m Bool
- socketWrite :: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) => a -> ByteString -> Maybe b -> m (SocketIOStatus, Word64)
- constructSocketAsyncContext :: (IsSocket o, MonadIO m) => Ptr () -> m (GValueConstruct o)
- getSocketAsyncContext :: (MonadIO m, IsSocket o) => o -> m (Ptr ())
- constructSocketFd :: (IsSocket o, MonadIO m) => Int32 -> m (GValueConstruct o)
- getSocketFd :: (MonadIO m, IsSocket o) => o -> m Int32
- constructSocketGsocket :: (IsSocket o, MonadIO m, IsSocket a) => a -> m (GValueConstruct o)
- constructSocketIostream :: (IsSocket o, MonadIO m, IsIOStream a) => a -> m (GValueConstruct o)
- constructSocketIpv6Only :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketIpv6Only :: (MonadIO m, IsSocket o) => o -> m Bool
- setSocketIpv6Only :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
- getSocketIsServer :: (MonadIO m, IsSocket o) => o -> m Bool
- constructSocketLocalAddress :: (IsSocket o, MonadIO m, IsAddress a) => a -> m (GValueConstruct o)
- getSocketLocalAddress :: (MonadIO m, IsSocket o) => o -> m Address
- constructSocketNonBlocking :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketNonBlocking :: (MonadIO m, IsSocket o) => o -> m Bool
- setSocketNonBlocking :: (MonadIO m, IsSocket o) => o -> Bool -> m ()
- constructSocketRemoteAddress :: (IsSocket o, MonadIO m, IsAddress a) => a -> m (GValueConstruct o)
- getSocketRemoteAddress :: (MonadIO m, IsSocket o) => o -> m Address
- constructSocketSslCreds :: (IsSocket o, MonadIO m) => Ptr () -> m (GValueConstruct o)
- getSocketSslCreds :: (MonadIO m, IsSocket o) => o -> m (Ptr ())
- setSocketSslCreds :: (MonadIO m, IsSocket o) => o -> Ptr () -> m ()
- constructSocketSslFallback :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketSslFallback :: (MonadIO m, IsSocket o) => o -> m Bool
- constructSocketSslStrict :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketSslStrict :: (MonadIO m, IsSocket o) => o -> m Bool
- constructSocketTimeout :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o)
- getSocketTimeout :: (MonadIO m, IsSocket o) => o -> m Word32
- setSocketTimeout :: (MonadIO m, IsSocket o) => o -> Word32 -> m ()
- getSocketTlsCertificate :: (MonadIO m, IsSocket o) => o -> m (Maybe TlsCertificate)
- getSocketTlsErrors :: (MonadIO m, IsSocket o) => o -> m [TlsCertificateFlags]
- getSocketTrustedCertificate :: (MonadIO m, IsSocket o) => o -> m Bool
- constructSocketUseThreadContext :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o)
- getSocketUseThreadContext :: (MonadIO m, IsSocket o) => o -> m Bool
- type SocketDisconnectedCallback = IO ()
- afterSocketDisconnected :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketDisconnectedCallback) -> m SignalHandlerId
- onSocketDisconnected :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketDisconnectedCallback) -> m SignalHandlerId
- type SocketEventCallback = SocketClientEvent -> IOStream -> IO ()
- afterSocketEvent :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketEventCallback) -> m SignalHandlerId
- onSocketEvent :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketEventCallback) -> m SignalHandlerId
- type SocketNewConnectionCallback = Socket -> IO ()
- afterSocketNewConnection :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketNewConnectionCallback) -> m SignalHandlerId
- onSocketNewConnection :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketNewConnectionCallback) -> m SignalHandlerId
- type SocketReadableCallback = IO ()
- afterSocketReadable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketReadableCallback) -> m SignalHandlerId
- onSocketReadable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketReadableCallback) -> m SignalHandlerId
- type SocketWritableCallback = IO ()
- afterSocketWritable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketWritableCallback) -> m SignalHandlerId
- onSocketWritable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketWritableCallback) -> m SignalHandlerId
Exported types
Memory-managed wrapper type.
Instances
Eq Socket Source # | |
GObject Socket Source # | |
Defined in GI.Soup.Objects.Socket | |
ManagedPtrNewtype Socket Source # | |
Defined in GI.Soup.Objects.Socket toManagedPtr :: Socket -> ManagedPtr Socket | |
TypedObject Socket Source # | |
Defined in GI.Soup.Objects.Socket | |
HasParentTypes Socket Source # | |
Defined in GI.Soup.Objects.Socket | |
IsGValue (Maybe Socket) Source # | Convert |
Defined in GI.Soup.Objects.Socket gvalueGType_ :: IO GType gvalueSet_ :: Ptr GValue -> Maybe Socket -> IO () gvalueGet_ :: Ptr GValue -> IO (Maybe Socket) | |
type ParentTypes Socket Source # | |
Defined in GI.Soup.Objects.Socket type ParentTypes Socket = '[Object, Initable] |
class (GObject o, IsDescendantOf Socket o) => IsSocket o Source #
Instances
(GObject o, IsDescendantOf Socket o) => IsSocket o Source # | |
Defined in GI.Soup.Objects.Socket |
Methods
Click to display all available methods, including inherited ones
Methods
bindProperty, bindPropertyFull, connectAsync, connectSync, disconnect, forceFloating, freezeNotify, getv, init, isConnected, isFloating, isSsl, listen, notify, notifyByPspec, read, readUntil, ref, refSink, runDispose, startProxySsl, startSsl, stealData, stealQdata, thawNotify, unref, watchClosure, write.
Getters
getData, getFd, getLocalAddress, getProperty, getQdata, getRemoteAddress.
Setters
connectAsync
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> SocketCallback |
|
-> m () |
Begins asynchronously connecting to sock
's remote address. The
socket will call callback
when it succeeds or fails (but not
before returning from this function).
If cancellable
is non-Nothing
, it can be used to cancel the
connection. callback
will still be invoked in this case, with a
status of StatusCancelled
.
connectSync
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m Word32 | Returns: a success or failure code. |
Attempt to synchronously connect sock
to its remote address.
If cancellable
is non-Nothing
, it can be used to cancel the
connection, in which case socketConnectSync
will return
StatusCancelled
.
disconnect
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m () |
Disconnects sock
. Any further read or write attempts on it will
fail.
getFd
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Int32 | Returns: |
Gets sock
's underlying file descriptor.
Note that fiddling with the file descriptor may break the
Socket
.
getLocalAddress
socketGetLocalAddress Source #
Returns the Address
corresponding to the local end of sock
.
Calling this method on an unconnected socket is considered to be an error, and produces undefined results.
getRemoteAddress
socketGetRemoteAddress Source #
Returns the Address
corresponding to the remote end of sock
.
Calling this method on an unconnected socket is considered to be an error, and produces undefined results.
isConnected
Tests if sock
is connected to another host
isSsl
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool | Returns: |
Tests if sock
is doing (or has attempted to do) SSL.
listen
:: (HasCallStack, MonadIO m, IsSocket a) | |
=> a |
|
-> m Bool | Returns: whether or not |
Makes sock
start listening on its local address. When connections
come in, sock
will emit Socket
::new_connection
.
read
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Maybe b |
|
-> m (SocketIOStatus, Word64) | Returns: a |
Attempts to read up to len
bytes from sock
into buffer
. If some
data is successfully read, socketRead
will return
SocketIOStatusOk
, and *nread
will contain the number of bytes
actually read (which may be less than len
).
If sock
is non-blocking, and no data is available, the return
value will be SocketIOStatusWouldBlock
. In this case, the caller
can connect to the Socket::readable signal to know when there
is more data to read. (NB: You MUST read all available data off the
socket first. Socket::readable is only emitted after
socketRead
returns SocketIOStatusWouldBlock
, and it is only
emitted once. See the documentation for Socket:nonBlocking.)
readUntil
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Ptr () |
|
-> Word64 |
|
-> Maybe b |
|
-> m (SocketIOStatus, Word64, Bool) | Returns: as for |
Like socketRead
, but reads no further than the first
occurrence of boundary
. (If the boundary is found, it will be
included in the returned data, and *gotBoundary
will be set to
True
.) Any data after the boundary will returned in future reads.
socketReadUntil
will almost always return fewer than len
bytes: if the boundary is found, then it will only return the bytes
up until the end of the boundary, and if the boundary is not found,
then it will leave the last <literal>(boundary_len - 1)</literal>
bytes in its internal buffer, in case they form the start of the
boundary string. Thus, len
normally needs to be at least 1 byte
longer than boundaryLen
if you want to make any progress at all.
startProxySsl
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> Text |
|
-> Maybe b |
|
-> m Bool | Returns: success or failure |
Starts using SSL on socket
, expecting to find a host named
sslHost
.
startSsl
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> Maybe b |
|
-> m Bool | Returns: success or failure |
Starts using SSL on socket
.
write
:: (HasCallStack, MonadIO m, IsSocket a, IsCancellable b) | |
=> a |
|
-> ByteString |
|
-> Maybe b |
|
-> m (SocketIOStatus, Word64) | Returns: a |
Attempts to write len
bytes from buffer
to sock
. If some data is
successfully written, the return status will be SocketIOStatusOk
,
and *nwrote
will contain the number of bytes actually written
(which may be less than len
).
If sock
is non-blocking, and no data could be written right away,
the return value will be SocketIOStatusWouldBlock
. In this case,
the caller can connect to the Socket::writable signal to know
when more data can be written. (NB: Socket::writable is only
emitted after socketWrite
returns SocketIOStatusWouldBlock
,
and it is only emitted once. See the documentation for
Socket:nonBlocking.)
Properties
asyncContext
No description available in the introspection data.
constructSocketAsyncContext :: (IsSocket o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “async-context
” property. This is rarely needed directly, but it is used by new
.
getSocketAsyncContext :: (MonadIO m, IsSocket o) => o -> m (Ptr ()) Source #
Get the value of the “async-context
” property.
When overloading is enabled, this is equivalent to
get
socket #asyncContext
fd
No description available in the introspection data.
constructSocketFd :: (IsSocket o, MonadIO m) => Int32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “fd
” property. This is rarely needed directly, but it is used by new
.
getSocketFd :: (MonadIO m, IsSocket o) => o -> m Int32 Source #
Get the value of the “fd
” property.
When overloading is enabled, this is equivalent to
get
socket #fd
gsocket
No description available in the introspection data.
constructSocketGsocket :: (IsSocket o, MonadIO m, IsSocket a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “gsocket
” property. This is rarely needed directly, but it is used by new
.
iostream
No description available in the introspection data.
constructSocketIostream :: (IsSocket o, MonadIO m, IsIOStream a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “iostream
” property. This is rarely needed directly, but it is used by new
.
ipv6Only
No description available in the introspection data.
constructSocketIpv6Only :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ipv6-only
” property. This is rarely needed directly, but it is used by new
.
getSocketIpv6Only :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “ipv6-only
” property.
When overloading is enabled, this is equivalent to
get
socket #ipv6Only
setSocketIpv6Only :: (MonadIO m, IsSocket o) => o -> Bool -> m () Source #
Set the value of the “ipv6-only
” property.
When overloading is enabled, this is equivalent to
set
socket [ #ipv6Only:=
value ]
isServer
Whether or not the socket is a server socket.
Note that for "ordinary" SoupSockets
this will be set for
both listening sockets and the sockets emitted by
Socket::newConnection, but for sockets created by
setting Socket:fd, it will only be set for listening
sockets.
getSocketIsServer :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “is-server
” property.
When overloading is enabled, this is equivalent to
get
socket #isServer
localAddress
No description available in the introspection data.
constructSocketLocalAddress :: (IsSocket o, MonadIO m, IsAddress a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “local-address
” property. This is rarely needed directly, but it is used by new
.
getSocketLocalAddress :: (MonadIO m, IsSocket o) => o -> m Address Source #
Get the value of the “local-address
” property.
When overloading is enabled, this is equivalent to
get
socket #localAddress
nonBlocking
Whether or not the socket uses non-blocking I/O.
Socket
's I/O methods are designed around the idea of
using a single codepath for both synchronous and
asynchronous I/O. If you want to read off a Socket
,
the "correct" way to do it is to call socketRead
or
socketReadUntil
repeatedly until you have read
everything you want. If it returns SocketIOStatusWouldBlock
at any point, stop reading and wait for it to emit the
Socket::readable signal. Then go back to the
reading-as-much-as-you-can loop. Likewise, for writing to a
Socket
, you should call socketWrite
either
until you have written everything, or it returns
SocketIOStatusWouldBlock
(in which case you wait for
Socket::writable and then go back into the loop).
Code written this way will work correctly with both
blocking and non-blocking sockets; blocking sockets will
simply never return SocketIOStatusWouldBlock
, and so the
code that handles that case just won't get used for them.
constructSocketNonBlocking :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “non-blocking
” property. This is rarely needed directly, but it is used by new
.
getSocketNonBlocking :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “non-blocking
” property.
When overloading is enabled, this is equivalent to
get
socket #nonBlocking
setSocketNonBlocking :: (MonadIO m, IsSocket o) => o -> Bool -> m () Source #
Set the value of the “non-blocking
” property.
When overloading is enabled, this is equivalent to
set
socket [ #nonBlocking:=
value ]
remoteAddress
No description available in the introspection data.
constructSocketRemoteAddress :: (IsSocket o, MonadIO m, IsAddress a) => a -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “remote-address
” property. This is rarely needed directly, but it is used by new
.
getSocketRemoteAddress :: (MonadIO m, IsSocket o) => o -> m Address Source #
Get the value of the “remote-address
” property.
When overloading is enabled, this is equivalent to
get
socket #remoteAddress
sslCreds
No description available in the introspection data.
constructSocketSslCreds :: (IsSocket o, MonadIO m) => Ptr () -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ssl-creds
” property. This is rarely needed directly, but it is used by new
.
getSocketSslCreds :: (MonadIO m, IsSocket o) => o -> m (Ptr ()) Source #
Get the value of the “ssl-creds
” property.
When overloading is enabled, this is equivalent to
get
socket #sslCreds
setSocketSslCreds :: (MonadIO m, IsSocket o) => o -> Ptr () -> m () Source #
Set the value of the “ssl-creds
” property.
When overloading is enabled, this is equivalent to
set
socket [ #sslCreds:=
value ]
sslFallback
No description available in the introspection data.
constructSocketSslFallback :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ssl-fallback
” property. This is rarely needed directly, but it is used by new
.
getSocketSslFallback :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “ssl-fallback
” property.
When overloading is enabled, this is equivalent to
get
socket #sslFallback
sslStrict
No description available in the introspection data.
constructSocketSslStrict :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “ssl-strict
” property. This is rarely needed directly, but it is used by new
.
getSocketSslStrict :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “ssl-strict
” property.
When overloading is enabled, this is equivalent to
get
socket #sslStrict
timeout
No description available in the introspection data.
constructSocketTimeout :: (IsSocket o, MonadIO m) => Word32 -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “timeout
” property. This is rarely needed directly, but it is used by new
.
getSocketTimeout :: (MonadIO m, IsSocket o) => o -> m Word32 Source #
Get the value of the “timeout
” property.
When overloading is enabled, this is equivalent to
get
socket #timeout
setSocketTimeout :: (MonadIO m, IsSocket o) => o -> Word32 -> m () Source #
Set the value of the “timeout
” property.
When overloading is enabled, this is equivalent to
set
socket [ #timeout:=
value ]
tlsCertificate
No description available in the introspection data.
getSocketTlsCertificate :: (MonadIO m, IsSocket o) => o -> m (Maybe TlsCertificate) Source #
Get the value of the “tls-certificate
” property.
When overloading is enabled, this is equivalent to
get
socket #tlsCertificate
tlsErrors
No description available in the introspection data.
getSocketTlsErrors :: (MonadIO m, IsSocket o) => o -> m [TlsCertificateFlags] Source #
Get the value of the “tls-errors
” property.
When overloading is enabled, this is equivalent to
get
socket #tlsErrors
trustedCertificate
No description available in the introspection data.
getSocketTrustedCertificate :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “trusted-certificate
” property.
When overloading is enabled, this is equivalent to
get
socket #trustedCertificate
useThreadContext
Use mainContextGetThreadDefault
.
Since: 2.38
constructSocketUseThreadContext :: (IsSocket o, MonadIO m) => Bool -> m (GValueConstruct o) Source #
Construct a GValueConstruct
with valid value for the “use-thread-context
” property. This is rarely needed directly, but it is used by new
.
getSocketUseThreadContext :: (MonadIO m, IsSocket o) => o -> m Bool Source #
Get the value of the “use-thread-context
” property.
When overloading is enabled, this is equivalent to
get
socket #useThreadContext
Signals
disconnected
type SocketDisconnectedCallback = IO () Source #
Emitted when the socket is disconnected, for whatever reason.
afterSocketDisconnected :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketDisconnectedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the disconnected signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
socket #disconnected callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSocketDisconnected :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketDisconnectedCallback) -> m SignalHandlerId Source #
Connect a signal handler for the disconnected signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
socket #disconnected callback
event
type SocketEventCallback Source #
= SocketClientEvent |
|
-> IOStream |
|
-> IO () |
Emitted when a network-related event occurs. See SocketClient::event for more details.
Since: 2.38
afterSocketEvent :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketEventCallback) -> m SignalHandlerId Source #
Connect a signal handler for the event signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
socket #event callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSocketEvent :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketEventCallback) -> m SignalHandlerId Source #
Connect a signal handler for the event signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
socket #event callback
newConnection
type SocketNewConnectionCallback Source #
Emitted when a listening socket (set up with
socketListen
) receives a new connection.
You must ref the new
if you want to keep it; otherwise it
will be destroyed after the signal is emitted.
afterSocketNewConnection :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketNewConnectionCallback) -> m SignalHandlerId Source #
Connect a signal handler for the newConnection signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
socket #newConnection callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSocketNewConnection :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketNewConnectionCallback) -> m SignalHandlerId Source #
Connect a signal handler for the newConnection signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
socket #newConnection callback
readable
type SocketReadableCallback = IO () Source #
Emitted when an async socket is readable. See
socketRead
, socketReadUntil
and
Socket:nonBlocking.
afterSocketReadable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketReadableCallback) -> m SignalHandlerId Source #
Connect a signal handler for the readable signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
socket #readable callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSocketReadable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketReadableCallback) -> m SignalHandlerId Source #
Connect a signal handler for the readable signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
socket #readable callback
writable
type SocketWritableCallback = IO () Source #
Emitted when an async socket is writable. See
socketWrite
and Socket:nonBlocking.
afterSocketWritable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketWritableCallback) -> m SignalHandlerId Source #
Connect a signal handler for the writable signal, to be run after the default handler. When overloading is enabled, this is equivalent to
after
socket #writable callback
By default the object invoking the signal is not passed to the callback.
If you need to access it, you can use the implit ?self
parameter.
Note that this requires activating the ImplicitParams
GHC extension.
onSocketWritable :: (IsSocket a, MonadIO m) => a -> ((?self :: a) => SocketWritableCallback) -> m SignalHandlerId Source #
Connect a signal handler for the writable signal, to be run before the default handler. When overloading is enabled, this is equivalent to
on
socket #writable callback