Holumbus-Distribution-0.1.0: intra- and inter-program communicationSource codeContentsIndex
Holumbus.Network.DoWithServer
Portabilityportable
Stabilityexperimental
MaintainerSebastian Reese (str@holumbus.org)
Description

Version : 0.1

This module provides an interface to start a server listeing on a tcp socket. ( Module is based on simple tcp server found here http:sequence.complete.orgnode258 )

You have to implement 2 functions type ServerAction a = a -> Client a -> [Client a] -> IO [Client a]

and

type LineConverter a = String -> a

to start a server use the doWithServer :: (Show a) => Int -> ServerAction a -> LineConverter a -> String -> IO () function.

Synopsis
data Client a = Client (TChan a) Handle HostName PortNumber
type ServerAction a = a -> Client a -> [Client a] -> IO [Client a]
type LineConverter a = String -> a
doWithServer :: Show a => Int -> ServerAction a -> LineConverter a -> String -> IO ()
Documentation
data Client a Source
the connecting client type
Constructors
Client (TChan a) Handle HostName PortNumber
show/hide Instances
type ServerAction a = a -> Client a -> [Client a] -> IO [Client a]Source
type for call back function that is executed within server cycle
type LineConverter a = String -> aSource
converts the string read by hGetLine to your datatype
doWithServer :: Show a => Int -> ServerAction a -> LineConverter a -> String -> IO ()Source
execute a ServerAction wrapped by the tcp server
Produced by Haddock version 2.6.1