This minimal module exports facilities that ease the usage of TCP
Sockets in the Pipes ecosystem. It is meant to be used together with
the Network.Simple.TCP module from the
network-simple package, which is
completely re-exported from this module.
This module does not export facilities that would allow you to acquire new
Sockets within a pipeline. If you need to do so, then you should use
Pipes.Network.TCP.Safe instead, which exports a similar API to the one
exported by this module. However, don't be confused by the word “safe” in
that module; this module is equally safe to use as long as you don't try to
acquire resources within the pipeline.
- fromSocket :: MonadIO m => Socket -> Int -> Producer' ByteString m ()
- fromSocketTimeout :: MonadIO m => Int -> Socket -> Int -> Producer' ByteString m ()
- fromSocketN :: MonadIO m => Socket -> Int -> Server' Int ByteString m ()
- fromSocketTimeoutN :: MonadIO m => Int -> Socket -> Int -> Server' Int ByteString m ()
- toSocket :: MonadIO m => Socket -> Consumer' ByteString m r
- toSocketTimeout :: MonadIO m => Int -> Socket -> Consumer' ByteString m r
- module Network.Simple.TCP
The following pipes allow you to receive bytes from the remote end.
|:: MonadIO m|
Maximum number of bytes to receive and send
dowstream at once. Any positive value is fine, the
optimal value depends on how you deal with the
received data. Try using
|-> Producer' ByteString m ()|
Receives bytes from the remote end sends them downstream.
The number of bytes received at once is always in the interval [1 .. specified maximum].
Producer' returns if the remote peer closes its side of the connection
or EOF is received.
The following pipes are bidirectional, which means useful data can flow through them upstream and downstream. If you don't care about bidirectional pipes, just skip this section.
The following pipes allow you to send bytes to the remote end.
Sends to the remote end each
ByteString received from upstream.