Copyright | (c) Dong Han 2018 |
---|---|
License | BSD |
Maintainer | winterland1989@gmail.com |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module provides an API for creating TCP servers and clients.
Synopsis
- data ClientConfig = ClientConfig {}
- defaultClientConfig :: ClientConfig
- initClient :: HasCallStack => ClientConfig -> Resource TCP
- data ServerConfig = ServerConfig {
- serverAddr :: SockAddr
- serverBackLog :: Int
- serverWorker :: TCP -> IO ()
- serverWorkerNoDelay :: Bool
- defaultServerConfig :: ServerConfig
- startServer :: HasCallStack => ServerConfig -> IO ()
- module Std.IO.SockAddr
TCP Client
data ClientConfig Source #
A TCP client configuration
ClientConfig | |
|
initClient :: HasCallStack => ClientConfig -> Resource TCP Source #
TCP Server
data ServerConfig Source #
A TCP server configuration
ServerConfig | |
|
defaultServerConfig :: ServerConfig Source #
A default hello world server on localhost:8888
Test it with main = startServer defaultServerConfig
, now try nc -v 127.0.0.1 8888
startServer :: HasCallStack => ServerConfig -> IO () Source #
Start a server
Fork new worker thread upon a new connection.
module Std.IO.SockAddr