network-run-0.4.3: 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 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.

openServerSocket :: AddrInfo -> IO Socket Source #

Open socket for server use

This is the same as:

openServerSocketWithOptions []

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