Holumbus-Distribution-0.1.0: intra- and inter-program communicationSource codeContentsIndex
Holumbus.Distribution.DNode.Network
Portabilityportable
Stabilityexperimental
MaintainerStefan Schmidt (stefanschmidt@web.de)
Contents
Server-Datatypes
Server-Operations
Client-Operations
Handle-Operations
Description

Version : 0.1

The Server-Module for the Holumbus framework.

It contains the lowlevel functions, like the socket handling (opening, reading, writing, ...).

Synopsis
data SocketServer
getSocketServerName :: SocketServer -> HostName
getSocketServerPort :: SocketServer -> PortNumber
type HandlerFunction a = Handle -> IO a
startSocketServer :: HandlerFunction () -> Int -> Int -> IO (Maybe SocketServer)
stopSocketServer :: SocketServer -> IO ()
performUnsafeSendRequest :: HandlerFunction a -> HostName -> PortNumber -> IO a
performSafeSendRequest :: HandlerFunction a -> a -> HostName -> PortNumber -> IO a
performMaybeSendRequest :: HandlerFunction a -> HostName -> PortNumber -> IO (Maybe a)
putByteStringMessage :: ByteString -> Handle -> IO ()
getByteStringMessage :: Handle -> IO ByteString
Server-Datatypes
data SocketServer Source
show/hide Instances
getSocketServerName :: SocketServer -> HostNameSource
getSocketServerPort :: SocketServer -> PortNumberSource
type HandlerFunction a = Handle -> IO aSource
Server-Operations
startSocketServerSource
:: HandlerFunction ()dispatcher function
-> Intstart port number
-> Intend port number
-> IO (Maybe SocketServer)
Creates a new (unix-)socket and starts the listener in its own thread. You'll get a reference to the listener Thread, so you can kill it with stopSocketServer. It is also possible to give a range of PortNumbers on which the socket will be opened. The first portnumber available will be taken.
stopSocketServer :: SocketServer -> IO ()Source
Stops a socker server by its internal thread id.
Client-Operations
performUnsafeSendRequest :: HandlerFunction a -> HostName -> PortNumber -> IO aSource
performSafeSendRequest :: HandlerFunction a -> a -> HostName -> PortNumber -> IO aSource
performMaybeSendRequest :: HandlerFunction a -> HostName -> PortNumber -> IO (Maybe a)Source
Handle-Operations
putByteStringMessage :: ByteString -> Handle -> IO ()Source
Puts a bytestring to a handle. But to make the reading easier, we write the length of the data as a message-header to the handle, too.
getByteStringMessage :: Handle -> IO ByteStringSource
Reads data from a stream. We define, that the first line of the message is the message header which tells us how much bytes we have to read.
Produced by Haddock version 2.6.1