-- 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.4.0.1

module Data.Conduit.Network

-- | Stream data from the socket.
--   
--   This function does <i>not</i> automatically close the socket.
--   
--   Since 0.0.0
sourceSocket :: MonadIO m => Socket -> Source m ByteString

-- | Stream data to the socket.
--   
--   This function does <i>not</i> automatically close the socket.
--   
--   Since 0.0.0
sinkSocket :: MonadIO m => Socket -> Sink ByteString m ()

-- | A simple TCP application. It takes two arguments: the <tt>Source</tt>
--   to read input data from, and the <tt>Sink</tt> to send output data to.
--   
--   Since 0.3.0
type Application m = Source m ByteString -> Sink ByteString m () -> m ()

-- | Settings for a TCP server. It takes a port to listen on, and an
--   optional hostname to bind to.
--   
--   Since 0.3.0
data ServerSettings
ServerSettings :: Int -> HostPreference -> ServerSettings
serverPort :: ServerSettings -> Int
serverHost :: ServerSettings -> HostPreference

-- | Run an <tt>Application</tt> 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.3.0
runTCPServer :: (MonadIO m, MonadBaseControl IO m) => ServerSettings -> Application 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 <tt>Application</tt> by connecting to the specified server.
--   
--   Since 0.2.1
runTCPClient :: (MonadIO m, MonadBaseControl IO m) => ClientSettings -> Application m -> m ()

-- | Which host to bind.
--   
--   Note: The <tt>IsString</tt> instance recognizes the following special
--   values:
--   
--   <ul>
--   <li><tt>*</tt> means <tt>HostAny</tt></li>
--   <li><tt>*4</tt> means <tt>HostIPv4</tt></li>
--   <li><tt>*6</tt> means <tt>HostIPv6</tt></li>
--   </ul>
data HostPreference
HostAny :: HostPreference
HostIPv4 :: HostPreference
HostIPv6 :: HostPreference
Host :: String -> HostPreference

-- | Attempt to bind a listening <tt>Socket</tt> on the given host/port. If
--   no host is given, will use the first address available.
--   
--   Since 0.3.0
bindPort :: Int -> HostPreference -> IO Socket

-- | Attempt to connect to the given host/port.
--   
--   Since 0.2.1
getSocket :: String -> Int -> IO Socket
instance Eq ClientSettings
instance Show ClientSettings
instance Read ClientSettings
instance Eq HostPreference
instance Ord HostPreference
instance Show HostPreference
instance Read HostPreference
instance Eq ServerSettings
instance Show ServerSettings
instance Read ServerSettings
instance IsString HostPreference
