Safe Haskell | Safe-Infered |
---|
- sourceSocket :: ResourceIO m => Socket -> Source m ByteString
- sinkSocket :: ResourceIO m => Socket -> Sink ByteString m ()
- type Application = Source IO ByteString -> Sink ByteString IO () -> ResourceT IO ()
- type ApplicationM m = Source m ByteString -> Sink ByteString m () -> ResourceT m ()
- data ServerSettings = ServerSettings {
- serverPort :: Int
- serverHost :: Maybe String
- runTCPServer :: (Base m ~ IO, ResourceIO m) => ServerSettings -> ApplicationM m -> m ()
- data ClientSettings = ClientSettings {
- clientPort :: Int
- clientHost :: String
- runTCPClient :: ResourceIO m => ClientSettings -> ApplicationM m -> m ()
- bindPort :: Maybe String -> Int -> IO Socket
- getSocket :: String -> Int -> IO Socket
Basic utilities
sourceSocket :: ResourceIO m => Socket -> Source m ByteStringSource
Stream data from the socket.
This function does not automatically close the socket.
Since 0.0.0
sinkSocket :: ResourceIO m => Socket -> Sink ByteString m ()Source
Stream data to the socket.
This function does not automatically close the socket.
Since 0.0.0
Simple TCP server/client interface.
type Application = Source IO ByteString -> Sink ByteString IO () -> ResourceT IO ()Source
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 ApplicationM m = Source m ByteString -> Sink ByteString m () -> ResourceT m ()Source
Same as Application
, but allows an arbitrary inner monad.
Since 0.2.2
Server
data ServerSettings Source
Settings for a TCP server. It takes a port to listen on, and an optional hostname to bind to.
Since 0.2.1
ServerSettings | |
|
runTCPServer :: (Base m ~ IO, ResourceIO m) => ServerSettings -> ApplicationM m -> m ()Source
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
Client
data ClientSettings Source
Settings for a TCP client, specifying how to connect to the server.
Since 0.2.1
runTCPClient :: ResourceIO m => ClientSettings -> ApplicationM m -> m ()Source
Run an Application
by connecting to the specified server.
Since 0.2.1