netlines-0.1.0: Enumerator tools for text-based network protocols

Stabilityexperimental
MaintainerErtugrul Soeylemez <es@ertes.de>

Network.NetLines

Contents

Description

Enumerator tools for working with text-based network protocols.

Synopsis

Conversion to lines

netLine :: forall m r. Monad m => Int -> MaybeT r (Iteratee ByteString m) ByteStringSource

Savely read a line with the given maximum length. If a longer line is enumerated, the excess data is dropped in constant space. Returns Nothing on EOF.

Please note that this function is very error-tolerant in the way it handles line endings. Both CR and LF are proper line terminators. This function ignores empty lines.

netLines :: forall b m. Monad m => Int -> Enumeratee ByteString ByteString m bSource

Convert a stream of bytes to a stream of lines with the given maximum length. Longer lines are silently truncated in constant space.

Enumerators

enumHandleTimeout :: forall b m. MonadIO m => Int -> Int -> Handle -> Enumerator ByteString m bSource

Enumerate from a handle with the given buffer size (first argument) and timeout in milliseconds (second argument). If the timeout is exceeded an exception is thrown via throwError.