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 UVStream
- data ServerConfig = ServerConfig {
- serverAddr :: SockAddr
- serverBackLog :: Int
- serverWorker :: UVStream -> IO ()
- serverWorkerNoDelay :: Bool
- defaultServerConfig :: ServerConfig
- startServer :: ServerConfig -> IO ()
- module Std.IO.SockAddr
TCP Client
data ClientConfig Source #
A TCP client configuration
initClient :: HasCallStack => ClientConfig -> Resource UVStream 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 :: ServerConfig -> IO () Source #
Start a server
Fork new worker thread upon a new connection.
module Std.IO.SockAddr