-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Stream socket data using conduits.
--
-- Stream socket data using conduits.
@package network-conduit
@version 0.2.2
module Data.Conduit.Network
-- | Stream data from the socket.
--
-- This function does not automatically close the socket.
--
-- Since 0.0.0
sourceSocket :: ResourceIO m => Socket -> Source m ByteString
-- | Stream data to the socket.
--
-- This function does not automatically close the socket.
--
-- Since 0.0.0
sinkSocket :: ResourceIO m => Socket -> Sink ByteString m ()
-- | A simple TCP application. It takes two arguments: the Source
-- to read input data from, and the Sink to send output data to.
--
-- Since 0.2.1
type Application = Source IO ByteString -> Sink ByteString IO () -> ResourceT IO ()
-- | Same as Application, but allows an arbitrary inner monad.
--
-- Since 0.2.2
type ApplicationM m = Source m ByteString -> Sink ByteString m () -> ResourceT m ()
-- | Settings for a TCP server. It takes a port to listen on, and an
-- optional hostname to bind to.
--
-- Since 0.2.1
data ServerSettings
ServerSettings :: Int -> Maybe String -> ServerSettings
serverPort :: ServerSettings -> Int
-- | Nothing indicates no preference
serverHost :: ServerSettings -> Maybe String
-- | Run an Application with the given settings. This function
-- will create a new listening socket, accept connections on it, and
-- spawn a new thread for each connection.
--
-- Since 0.2.1
runTCPServer :: (Base m ~ IO, ResourceIO m) => ServerSettings -> ApplicationM m -> m ()
-- | Settings for a TCP client, specifying how to connect to the server.
--
-- Since 0.2.1
data ClientSettings
ClientSettings :: Int -> String -> ClientSettings
clientPort :: ClientSettings -> Int
clientHost :: ClientSettings -> String
-- | Run an Application by connecting to the specified server.
--
-- Since 0.2.1
runTCPClient :: ResourceIO m => ClientSettings -> ApplicationM m -> m ()
-- | Attempt to bind a listening Socket on the given host/port. If
-- no host is given, will use the first address available.
--
-- Since 0.2.1
bindPort :: Maybe String -> Int -> IO Socket
-- | Attempt to connect to the given host/port.
--
-- Since 0.2.1
getSocket :: String -> Int -> IO Socket