network-run-0.3.0: Simple network runner library
Safe HaskellSafe-Inferred
LanguageHaskell2010

Network.Run.TCP.Timeout

Description

Simple functions to run TCP clients and servers.

Synopsis

Documentation

runTCPServer Source #

Arguments

:: Int

Timeout in second.

-> Maybe HostName 
-> ServiceName 
-> TimeoutServer a 
-> IO a 

Running a TCP server with an accepted socket and its peer name.

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

:: (AddrInfo -> IO Socket) 
-> Int

Timeout in second.

-> Maybe HostName 
-> ServiceName 
-> TimeoutServer a 
-> IO a 

Generalization of runTCPServer

See runTCPServerWithSocket for additional discussion.

openServerSocket :: AddrInfo -> IO Socket Source #

Open socket for server use

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