binary-communicator-1.0: Send and receive binary data.

Data.BinaryCom

Synopsis

Documentation

data BinaryCom Source

BinaryCom type

binaryCom :: MonadIO m => Handle -> m BinaryComSource

Creates a BinaryCom from a Handle opened for both reading and writing. Be careful not to use the handle afterwards

binaryCom' :: MonadIO m => Handle -> Handle -> m BinaryComSource

Creates a BinaryCom from two Handles: one for reading, one for writing

binaryCom'' :: MonadIO m => ByteString -> Handle -> m BinaryComSource

Creates a BinaryCom from a lazy ByteString (for reading) and a Handle (for writing)

send :: (Binary a, MonadIO m) => BinaryCom -> a -> m ()Source

Sends a serializable value through a BinaryCom

flush :: MonadIO m => BinaryCom -> m ()Source

Flushes a BinaryCom. Do not forget to do this after sending!

sendFlush :: (Binary a, MonadIO m) => BinaryCom -> a -> m ()Source

Shortcut for sending a value and flushing the BinaryCom

receive :: (Binary a, MonadIO m) => BinaryCom -> m aSource

Receives a serializable value through a BinaryCom