Copyright | (c) 2010-2013 Toralf Wittner |
---|---|
License | MIT |
Maintainer | Toralf Wittner <tw@dtex.org> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell98 |
System.ZMQ4
Description
0MQ haskell binding. The API closely follows the C-API of 0MQ with the main difference being that sockets are typed.
Notes
Many option settings use a Restriction
to further constrain the
range of possible values of their integral types. For example
the maximum message size can be given as -1, which means no limit
or by greater values, which denote the message size in bytes. The
type of setMaxMessageSize
is therefore:
setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket a -> IO ()
which means any integral value in the range of -1
to
(maxBound :: Int64
) can be given. To create a restricted
value from plain value, use toRestricted
or restrict
.
Synopsis
- data Pair = Pair
- data Pub = Pub
- data Sub = Sub
- data XPub = XPub
- data XSub = XSub
- data Req = Req
- data Rep = Rep
- data Dealer = Dealer
- data Router = Router
- type XReq = Dealer
- type XRep = Router
- data Pull = Pull
- data Push = Push
- data Stream = Stream
- class SocketType a
- class Sender a
- class Receiver a
- class Subscriber a
- class SocketLike s
- class Conflatable a
- class SendProbe a
- type Size = Word
- data Context
- data Socket a
- data Flag
- data Switch
- type Timeout = Int64
- data Event
- data EventType
- data EventMsg
- = Connected !ByteString !Fd
- | ConnectDelayed !ByteString
- | ConnectRetried !ByteString !Int
- | Listening !ByteString !Fd
- | BindFailed !ByteString !Int
- | Accepted !ByteString !Fd
- | AcceptFailed !ByteString !Int
- | Closed !ByteString !Fd
- | CloseFailed !ByteString !Int
- | Disconnected !ByteString !Fd
- | MonitorStopped !ByteString !Int
- data Poll s m where
- data KeyFormat a where
- data SecurityMechanism
- withContext :: (Context -> IO a) -> IO a
- withSocket :: SocketType a => Context -> a -> (Socket a -> IO b) -> IO b
- bind :: Socket a -> String -> IO ()
- unbind :: Socket a -> String -> IO ()
- connect :: Socket a -> String -> IO ()
- disconnect :: Socket a -> String -> IO ()
- send :: Sender a => Socket a -> [Flag] -> ByteString -> IO ()
- send' :: Sender a => Socket a -> [Flag] -> ByteString -> IO ()
- sendMulti :: Sender a => Socket a -> NonEmpty ByteString -> IO ()
- receive :: Receiver a => Socket a -> IO ByteString
- receiveMulti :: Receiver a => Socket a -> IO [ByteString]
- version :: IO (Int, Int, Int)
- monitor :: [EventType] -> Context -> Socket a -> IO (Bool -> IO (Maybe EventMsg))
- socketMonitor :: [EventType] -> String -> Socket a -> IO ()
- poll :: (SocketLike s, MonadIO m) => Timeout -> [Poll s m] -> m [[Event]]
- subscribe :: Subscriber a => Socket a -> ByteString -> IO ()
- unsubscribe :: Subscriber a => Socket a -> ByteString -> IO ()
- ioThreads :: Context -> IO Word
- maxSockets :: Context -> IO Word
- setIoThreads :: Word -> Context -> IO ()
- setMaxSockets :: Word -> Context -> IO ()
- affinity :: Socket a -> IO Word64
- backlog :: Socket a -> IO Int
- conflate :: Conflatable a => Socket a -> IO Bool
- curvePublicKey :: KeyFormat f -> Socket a -> IO ByteString
- curveSecretKey :: KeyFormat f -> Socket a -> IO ByteString
- curveServerKey :: KeyFormat f -> Socket a -> IO ByteString
- delayAttachOnConnect :: Socket a -> IO Bool
- events :: Socket a -> IO [Event]
- fileDescriptor :: Socket a -> IO Fd
- identity :: Socket a -> IO ByteString
- immediate :: Socket a -> IO Bool
- ipv4Only :: Socket a -> IO Bool
- ipv6 :: Socket a -> IO Bool
- lastEndpoint :: Socket a -> IO String
- linger :: Socket a -> IO Int
- maxMessageSize :: Socket a -> IO Int64
- mcastHops :: Socket a -> IO Int
- mechanism :: Socket a -> IO SecurityMechanism
- moreToReceive :: Socket a -> IO Bool
- plainServer :: Socket a -> IO Bool
- plainPassword :: Socket a -> IO ByteString
- plainUserName :: Socket a -> IO ByteString
- rate :: Socket a -> IO Int
- receiveBuffer :: Socket a -> IO Int
- receiveHighWM :: Socket a -> IO Int
- receiveTimeout :: Socket a -> IO Int
- reconnectInterval :: Socket a -> IO Int
- reconnectIntervalMax :: Socket a -> IO Int
- recoveryInterval :: Socket a -> IO Int
- sendBuffer :: Socket a -> IO Int
- sendHighWM :: Socket a -> IO Int
- sendTimeout :: Socket a -> IO Int
- tcpKeepAlive :: Socket a -> IO Switch
- tcpKeepAliveCount :: Socket a -> IO Int
- tcpKeepAliveIdle :: Socket a -> IO Int
- tcpKeepAliveInterval :: Socket a -> IO Int
- zapDomain :: Socket a -> IO ByteString
- setAffinity :: Word64 -> Socket a -> IO ()
- setBacklog :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setConflate :: Conflatable a => Bool -> Socket a -> IO ()
- setCurveServer :: Bool -> Socket a -> IO ()
- setCurvePublicKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
- setCurveSecretKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
- setCurveServerKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO ()
- setDelayAttachOnConnect :: Bool -> Socket a -> IO ()
- setIdentity :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- setImmediate :: Bool -> Socket a -> IO ()
- setIpv4Only :: Bool -> Socket a -> IO ()
- setIpv6 :: Bool -> Socket a -> IO ()
- setLinger :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket a -> IO ()
- setMcastHops :: Integral i => Restricted (N1, Int32) i -> Socket a -> IO ()
- setPlainServer :: Bool -> Socket a -> IO ()
- setPlainPassword :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- setPlainUserName :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- setProbeRouter :: SendProbe a => Bool -> Socket a -> IO ()
- setRate :: Integral i => Restricted (N1, Int32) i -> Socket a -> IO ()
- setReceiveBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReceiveHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReceiveTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setReconnectInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReconnectIntervalMax :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setRecoveryInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setReqCorrelate :: Bool -> Socket Req -> IO ()
- setReqRelaxed :: Bool -> Socket Req -> IO ()
- setRouterMandatory :: Bool -> Socket Router -> IO ()
- setSendBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setSendHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO ()
- setSendTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setTcpAcceptFilter :: Maybe ByteString -> Socket a -> IO ()
- setTcpKeepAlive :: Switch -> Socket a -> IO ()
- setTcpKeepAliveCount :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setTcpKeepAliveIdle :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setTcpKeepAliveInterval :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO ()
- setXPubVerbose :: Bool -> Socket XPub -> IO ()
- setZapDomain :: Restricted (N1, N254) ByteString -> Socket a -> IO ()
- restrict :: Restriction r v => v -> Restricted r v
- toRestricted :: Restriction r v => v -> Maybe (Restricted r v)
- data ZMQError
- errno :: ZMQError -> Int
- source :: ZMQError -> String
- message :: ZMQError -> String
- init :: Size -> IO Context
- term :: Context -> IO ()
- shutdown :: Context -> IO ()
- context :: IO Context
- socket :: SocketType a => Context -> a -> IO (Socket a)
- close :: Socket a -> IO ()
- waitRead :: Socket a -> IO ()
- waitWrite :: Socket a -> IO ()
- z85Encode :: MonadIO m => Restricted Div4 ByteString -> m ByteString
- z85Decode :: MonadIO m => Restricted Div5 ByteString -> m ByteString
- proxy :: Socket a -> Socket b -> Maybe (Socket c) -> IO ()
- curveKeyPair :: MonadIO m => m (Restricted Div5 ByteString, Restricted Div5 ByteString)
Type Definitions
Socket Types
Constructors
Pair |
Instances
Eq Pair # | |
Generic Pair # | |
SocketType Pair # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Pair -> ZMQSocketType # | |
Receiver Pair # | |
Defined in System.ZMQ4 | |
Sender Pair # | |
Defined in System.ZMQ4 | |
type Rep Pair # | |
Constructors
Pub |
Instances
Eq Pub # | |
Generic Pub # | |
SocketType Pub # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Pub -> ZMQSocketType # | |
Conflatable Pub # | |
Defined in System.ZMQ4 | |
Sender Pub # | |
Defined in System.ZMQ4 | |
type Rep Pub # | |
Constructors
Sub |
Instances
Eq Sub # | |
Generic Sub # | |
SocketType Sub # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Sub -> ZMQSocketType # | |
Conflatable Sub # | |
Defined in System.ZMQ4 | |
Receiver Sub # | |
Defined in System.ZMQ4 | |
Subscriber Sub # | |
Defined in System.ZMQ4 | |
type Rep Sub # | |
Constructors
XPub |
Instances
Eq XPub # | |
Generic XPub # | |
SocketType XPub # | |
Defined in System.ZMQ4 Methods zmqSocketType :: XPub -> ZMQSocketType # | |
Receiver XPub # | |
Defined in System.ZMQ4 | |
Sender XPub # | |
Defined in System.ZMQ4 | |
type Rep XPub # | |
Constructors
XSub |
Instances
Eq XSub # | |
Generic XSub # | |
SocketType XSub # | |
Defined in System.ZMQ4 Methods zmqSocketType :: XSub -> ZMQSocketType # | |
Receiver XSub # | |
Defined in System.ZMQ4 | |
Sender XSub # | |
Defined in System.ZMQ4 | |
type Rep XSub # | |
Constructors
Req |
Instances
Eq Req # | |
Generic Req # | |
SocketType Req # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Req -> ZMQSocketType # | |
SendProbe Req # | |
Defined in System.ZMQ4 | |
Receiver Req # | |
Defined in System.ZMQ4 | |
Sender Req # | |
Defined in System.ZMQ4 | |
type Rep Req # | |
Constructors
Rep |
Instances
Eq Rep # | |
Generic Rep # | |
SocketType Rep # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Rep -> ZMQSocketType # | |
Receiver Rep # | |
Defined in System.ZMQ4 | |
Sender Rep # | |
Defined in System.ZMQ4 | |
type Rep Rep # | |
Constructors
Dealer |
Instances
Eq Dealer # | |
Generic Dealer # | |
SocketType Dealer # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Dealer -> ZMQSocketType # | |
SendProbe Dealer # | |
Defined in System.ZMQ4 | |
Conflatable Dealer # | |
Defined in System.ZMQ4 | |
Receiver Dealer # | |
Defined in System.ZMQ4 | |
Sender Dealer # | |
Defined in System.ZMQ4 | |
type Rep Dealer # | |
Constructors
Router |
Instances
Eq Router # | |
Generic Router # | |
SocketType Router # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Router -> ZMQSocketType # | |
SendProbe Router # | |
Defined in System.ZMQ4 | |
Receiver Router # | |
Defined in System.ZMQ4 | |
Sender Router # | |
Defined in System.ZMQ4 | |
type Rep Router # | |
Constructors
Pull |
Instances
Eq Pull # | |
Generic Pull # | |
SocketType Pull # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Pull -> ZMQSocketType # | |
Conflatable Pull # | |
Defined in System.ZMQ4 | |
Receiver Pull # | |
Defined in System.ZMQ4 | |
type Rep Pull # | |
Constructors
Push |
Instances
Eq Push # | |
Generic Push # | |
SocketType Push # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Push -> ZMQSocketType # | |
Conflatable Push # | |
Defined in System.ZMQ4 | |
Sender Push # | |
Defined in System.ZMQ4 | |
type Rep Push # | |
Constructors
Stream |
Instances
Eq Stream # | |
Generic Stream # | |
SocketType Stream # | |
Defined in System.ZMQ4 Methods zmqSocketType :: Stream -> ZMQSocketType # | |
Receiver Stream # | |
Defined in System.ZMQ4 | |
Sender Stream # | |
Defined in System.ZMQ4 | |
type Rep Stream # | |
Socket type-classes
class SocketType a #
Socket types.
Minimal complete definition
Instances
Sockets which can send
.
Instances
Sender Stream # | |
Defined in System.ZMQ4 | |
Sender Push # | |
Defined in System.ZMQ4 | |
Sender Router # | |
Defined in System.ZMQ4 | |
Sender Dealer # | |
Defined in System.ZMQ4 | |
Sender Rep # | |
Defined in System.ZMQ4 | |
Sender Req # | |
Defined in System.ZMQ4 | |
Sender XSub # | |
Defined in System.ZMQ4 | |
Sender XPub # | |
Defined in System.ZMQ4 | |
Sender Pub # | |
Defined in System.ZMQ4 | |
Sender Pair # | |
Defined in System.ZMQ4 |
Sockets which can receive
.
Instances
Receiver Stream # | |
Defined in System.ZMQ4 | |
Receiver Pull # | |
Defined in System.ZMQ4 | |
Receiver Router # | |
Defined in System.ZMQ4 | |
Receiver Dealer # | |
Defined in System.ZMQ4 | |
Receiver Rep # | |
Defined in System.ZMQ4 | |
Receiver Req # | |
Defined in System.ZMQ4 | |
Receiver XSub # | |
Defined in System.ZMQ4 | |
Receiver XPub # | |
Defined in System.ZMQ4 | |
Receiver Sub # | |
Defined in System.ZMQ4 | |
Receiver Pair # | |
Defined in System.ZMQ4 |
class SocketLike s #
Minimal complete definition
Instances
SocketLike Socket # | |
Defined in System.ZMQ4.Internal | |
SocketLike (Socket z) # | |
Defined in System.ZMQ4.Monadic |
class Conflatable a #
Sockets which can be conflate
d.
Instances
Conflatable Push # | |
Defined in System.ZMQ4 | |
Conflatable Pull # | |
Defined in System.ZMQ4 | |
Conflatable Dealer # | |
Defined in System.ZMQ4 | |
Conflatable Sub # | |
Defined in System.ZMQ4 | |
Conflatable Pub # | |
Defined in System.ZMQ4 |
Sockets which can send probes (cf. setProbeRouter
).
Instances
SendProbe Router # | |
Defined in System.ZMQ4 | |
SendProbe Dealer # | |
Defined in System.ZMQ4 | |
SendProbe Req # | |
Defined in System.ZMQ4 |
Various type definitions
A 0MQ Socket.
Instances
SocketLike Socket # | |
Defined in System.ZMQ4.Internal |
Socket events.
Constructors
In |
|
Out |
|
Err | ZMQ_POLLERR |
Event types to monitor.
Constructors
ConnectedEvent | |
ConnectDelayedEvent | |
ConnectRetriedEvent | |
ListeningEvent | |
BindFailedEvent | |
AcceptedEvent | |
AcceptFailedEvent | |
ClosedEvent | |
CloseFailedEvent | |
DisconnectedEvent | |
MonitorStoppedEvent | |
AllEvents |
Instances
Eq EventType # | |
Ord EventType # | |
Show EventType # | |
Event Message to receive when monitoring socket events.
Constructors
Constructors
BinaryFormat :: KeyFormat Div4 | |
TextFormat :: KeyFormat Div5 |
data SecurityMechanism #
Instances
Eq SecurityMechanism # | |
Defined in System.ZMQ4.Internal Methods (==) :: SecurityMechanism -> SecurityMechanism -> Bool # (/=) :: SecurityMechanism -> SecurityMechanism -> Bool # | |
Show SecurityMechanism # | |
Defined in System.ZMQ4.Internal Methods showsPrec :: Int -> SecurityMechanism -> ShowS # show :: SecurityMechanism -> String # showList :: [SecurityMechanism] -> ShowS # |
General Operations
withContext :: (Context -> IO a) -> IO a #
Run an action with a 0MQ context. The Context
supplied to your
action will not be valid after the action either returns or
throws an exception.
withSocket :: SocketType a => Context -> a -> (Socket a -> IO b) -> IO b #
Run an action with a 0MQ socket. The socket will be closed after running the supplied action even if an error occurs. The socket supplied to your action will not be valid after the action terminates.
disconnect :: Socket a -> String -> IO () #
Disconnect the socket from the given endpoint (cf. zmq_disconnect).
send :: Sender a => Socket a -> [Flag] -> ByteString -> IO () #
Send the given ByteString
over the socket
(cf. zmq_sendmsg).
Note: This function always calls zmq_sendmsg
in a non-blocking way,
i.e. there is no need to provide the ZMQ_DONTWAIT
flag as this is used
by default. Still send
is blocking the thread as long as the message
can not be queued on the socket using GHC's threadWaitWrite
.
send' :: Sender a => Socket a -> [Flag] -> ByteString -> IO () #
Send the given ByteString
over the socket
(cf. zmq_sendmsg).
This is operationally identical to send socket (Strict.concat
(Lazy.toChunks lbs)) flags
but may be more efficient.
Note: This function always calls zmq_sendmsg
in a non-blocking way,
i.e. there is no need to provide the ZMQ_DONTWAIT
flag as this is used
by default. Still send'
is blocking the thread as long as the message
can not be queued on the socket using GHC's threadWaitWrite
.
sendMulti :: Sender a => Socket a -> NonEmpty ByteString -> IO () #
Send a multi-part message.
This function applies the SendMore
Flag
between all message parts.
0MQ guarantees atomic delivery of a multi-part message
(cf. zmq_sendmsg).
receive :: Receiver a => Socket a -> IO ByteString #
Receive a ByteString
from socket
(cf. zmq_recvmsg).
Note: This function always calls zmq_recvmsg
in a non-blocking way,
i.e. there is no need to provide the ZMQ_DONTWAIT
flag as this is used
by default. Still receive
is blocking the thread as long as no data
is available using GHC's threadWaitRead
.
receiveMulti :: Receiver a => Socket a -> IO [ByteString] #
Receive a multi-part message.
This function collects all message parts send via sendMulti
.
version :: IO (Int, Int, Int) #
Return the runtime version of the underlying 0MQ library as a (major, minor, patch) triple.
monitor :: [EventType] -> Context -> Socket a -> IO (Bool -> IO (Maybe EventMsg)) #
Monitor socket events (cf. zmq_socket_monitor).
This function returns a function which can be invoked to retrieve
the next socket event, potentially blocking until the next one becomes
available. When applied to False
, monitoring will terminate, i.e.
internal monitoring resources will be disposed. Consequently after
monitor
has been invoked, the returned function must be applied
once to False
.
subscribe :: Subscriber a => Socket a -> ByteString -> IO () #
Subscribe Socket to given subscription.
unsubscribe :: Subscriber a => Socket a -> ByteString -> IO () #
Unsubscribe Socket from given subscription.
Context Options (Read)
Context Options (Write)
setIoThreads :: Word -> Context -> IO () #
setMaxSockets :: Word -> Context -> IO () #
Socket Options (Read)
conflate :: Conflatable a => Socket a -> IO Bool #
Restricts the outgoing and incoming socket buffers to a single message.
curvePublicKey :: KeyFormat f -> Socket a -> IO ByteString #
curveSecretKey :: KeyFormat f -> Socket a -> IO ByteString #
curveServerKey :: KeyFormat f -> Socket a -> IO ByteString #
delayAttachOnConnect :: Socket a -> IO Bool #
Deprecated: Use immediate
fileDescriptor :: Socket a -> IO Fd #
moreToReceive :: Socket a -> IO Bool #
receiveBuffer :: Socket a -> IO Int #
receiveHighWM :: Socket a -> IO Int #
sendBuffer :: Socket a -> IO Int #
sendHighWM :: Socket a -> IO Int #
sendTimeout :: Socket a -> IO Int #
Socket Options (Write)
setAffinity :: Word64 -> Socket a -> IO () #
setBacklog :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setConflate :: Conflatable a => Bool -> Socket a -> IO () #
Restrict the outgoing and incoming socket buffers to a single message.
setCurveServer :: Bool -> Socket a -> IO () #
setCurvePublicKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO () #
setCurveSecretKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO () #
setCurveServerKey :: KeyFormat f -> Restricted f ByteString -> Socket a -> IO () #
setDelayAttachOnConnect :: Bool -> Socket a -> IO () #
Deprecated: Use setImmediate
setIdentity :: Restricted (N1, N254) ByteString -> Socket a -> IO () #
setImmediate :: Bool -> Socket a -> IO () #
setIpv4Only :: Bool -> Socket a -> IO () #
Deprecated: Use setIpv6
setMaxMessageSize :: Integral i => Restricted (Nneg1, Int64) i -> Socket a -> IO () #
setMcastHops :: Integral i => Restricted (N1, Int32) i -> Socket a -> IO () #
setPlainServer :: Bool -> Socket a -> IO () #
setPlainPassword :: Restricted (N1, N254) ByteString -> Socket a -> IO () #
setPlainUserName :: Restricted (N1, N254) ByteString -> Socket a -> IO () #
setReceiveBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setReceiveHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setReceiveTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #
setReconnectInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setReconnectIntervalMax :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setRecoveryInterval :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setSendBuffer :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setSendHighWM :: Integral i => Restricted (N0, Int32) i -> Socket a -> IO () #
setSendTimeout :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #
setTcpAcceptFilter :: Maybe ByteString -> Socket a -> IO () #
setTcpKeepAlive :: Switch -> Socket a -> IO () #
setTcpKeepAliveCount :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #
setTcpKeepAliveIdle :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #
setTcpKeepAliveInterval :: Integral i => Restricted (Nneg1, Int32) i -> Socket a -> IO () #
setZapDomain :: Restricted (N1, N254) ByteString -> Socket a -> IO () #
Restrictions
restrict :: Restriction r v => v -> Restricted r v #
Create a restricted value. If the given value does not satisfy the restrictions, a modified variant is used instead, e.g. if an integer is larger than the upper bound, the upper bound value is used.
toRestricted :: Restriction r v => v -> Maybe (Restricted r v) #
Create a restricted value. Returns Nothing
if
the given value does not satisfy all restrictions.
Error Handling
ZMQError encapsulates information about errors, which occur when using the native 0MQ API, such as error number and message.
Instances
Eq ZMQError # | |
Ord ZMQError # | |
Defined in System.ZMQ4.Internal.Error | |
Show ZMQError # | |
Exception ZMQError # | |
Defined in System.ZMQ4.Internal.Error Methods toException :: ZMQError -> SomeException # fromException :: SomeException -> Maybe ZMQError # displayException :: ZMQError -> String # |
Low-level Functions
Terminate a 0MQ context. Equivalent to zmq_ctx_term.
shutdown :: Context -> IO () #
Shutdown a 0MQ context. Equivalent to zmq_ctx_shutdown.
Initialize a 0MQ context. Equivalent to zmq_ctx_new.
socket :: SocketType a => Context -> a -> IO (Socket a) #
Create a new 0MQ socket within the given context. withSocket
provides
automatic socket closing and may be safer to use.
Close a 0MQ socket. withSocket
provides automatic socket closing and may
be safer to use.
waitRead :: Socket a -> IO () #
Wait until data is available for reading from the given Socket.
After this function returns, a call to receive
will essentially be
non-blocking.
waitWrite :: Socket a -> IO () #
Wait until data can be written to the given Socket.
After this function returns, a call to send
will essentially be
non-blocking.
z85Encode :: MonadIO m => Restricted Div4 ByteString -> m ByteString #
z85Decode :: MonadIO m => Restricted Div5 ByteString -> m ByteString #
Utils
proxy :: Socket a -> Socket b -> Maybe (Socket c) -> IO () #
Starts built-in 0MQ proxy (cf. zmq_proxy)
Proxy connects front to back socket
Before calling proxy all sockets should be bound
If the capture socket is not Nothing, the proxy shall send all messages, received on both frontend and backend, to the capture socket.
curveKeyPair :: MonadIO m => m (Restricted Div5 ByteString, Restricted Div5 ByteString) #
Generate a new curve key pair. (cf. zmq_curve_keypair)