- genericServer :: Int -> (Handle -> IO ByteString) -> (ByteString -> IO ByteString) -> IO ()
- readUntilEmptyLine :: Handle -> IO ByteString
- waitData :: Int -> Int -> IO ByteString
- class Server s where
- type Request s
- type Response s
- toRequest :: s -> ByteString -> Request s
- fromResponse :: s -> Response s -> ByteString
- requestReader :: s -> Handle -> IO ByteString
- worker :: s -> Request s -> IO (Response s, s)
- getServer :: s -> IO s
- putServer :: s -> IO ()
- wrap :: (a -> IO b) -> s -> a -> IO (b, s)
- server :: forall s. Server s => s -> Int -> IO ()
Documentation
:: Int | Port number |
-> (Handle -> IO ByteString) | Query reading function |
-> (ByteString -> IO ByteString) | Worker function |
-> IO () |
Run TCP/IP server with any worker funciton
:: Int | Port number |
-> Int | Data size |
-> IO ByteString |
Read given amount of bytes from socket
toRequest :: s -> ByteString -> Request sSource
fromResponse :: s -> Response s -> ByteStringSource
requestReader :: s -> Handle -> IO ByteStringSource