Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Network.Run.TCP.Timeout
Contents
Description
Simple functions to run TCP clients and servers.
Synopsis
- runTCPServer :: Int -> Maybe HostName -> ServiceName -> TimeoutServer a -> IO a
- type TimeoutServer a = Manager -> Handle -> Socket -> IO a
- runTCPServerWithSocket :: Int -> Socket -> TimeoutServer a -> IO a
- openServerSocket :: AddrInfo -> IO Socket
- openServerSocketWithOptions :: [(SocketOption, Int)] -> AddrInfo -> IO Socket
- openServerSocketWithOpts :: [(SocketOption, SockOptValue)] -> AddrInfo -> IO Socket
Documentation
Arguments
:: Int | Timeout in second. |
-> Maybe HostName | |
-> ServiceName | |
-> TimeoutServer a | |
-> IO a |
Running a TCP server with a connected socket.
type TimeoutServer a Source #
Arguments
= Manager | A global timeout manager |
-> Handle | A thread-local timeout handler |
-> Socket | A connected socket |
-> IO a |
A server type
Generalized API
runTCPServerWithSocket Source #
Arguments
:: Int | Timeout in second. |
-> Socket | |
-> TimeoutServer a | |
-> IO a |
Running a TCP client with a connected socket for a given listen socket.
openServerSocketWithOptions :: [(SocketOption, Int)] -> AddrInfo -> IO Socket Source #
Open socket for server use, and set the provided options before binding.
This is equivalent to
openServerSocketWithOpts
.map
(second
SockOptValue
)
openServerSocketWithOpts :: [(SocketOption, SockOptValue)] -> AddrInfo -> IO Socket Source #
Open socket for server use, and set the provided options before binding.
In addition to the given options, the socket is configured to
- allow reuse of local addresses (SO_REUSEADDR)
- automatically be closed during a successful
execve
(FD_CLOEXEC) - bind to the address specified