Holumbus-Distribution-0.1.0: intra- and inter-program communicationSource codeContentsIndex
Holumbus.Network.Core
Portabilityportable
Stabilityexperimental
MaintainerStefan Schmidt (stefanschmidt@web.de)
Contents
Socket-Descriptor
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 SocketId = SocketId HostName PortNumber
startSocket :: ServerDispatcher -> PortNumber -> PortNumber -> IO (Maybe (ThreadId, HostName, PortNumber))
sendRequest :: (Handle -> IO a) -> HostName -> PortNumber -> IO a
performUnsafeSendRequest :: (Handle -> IO a) -> HostName -> PortNumber -> IO a
performSafeSendRequest :: (Handle -> IO a) -> a -> HostName -> PortNumber -> IO a
performMaybeSendRequest :: (Handle -> IO a) -> HostName -> PortNumber -> IO (Maybe a)
putMessage :: ByteString -> Handle -> IO ()
getMessage :: Handle -> IO ByteString
data ThreadIdException = ThreadIdException ThreadId
Socket-Descriptor
data SocketId Source
All data, that is needed to address a socket. Contains the hostname and the portNumber.
Constructors
SocketId HostName PortNumber
show/hide Instances
Server-Operations
startSocketSource
:: ServerDispatcherdispatcher function
-> PortNumberstart port number
-> PortNumberend port number
-> IO (Maybe (ThreadId, HostName, PortNumber))
Creates a new (unix-)socket and starts the listener in its own thread. You'll get the threadId of the listener Thread, so you can kill it. It is also possible to give a range of PortNumbers on which the socket will be opened. The first portnumber available will be taken.
Client-Operations
sendRequest :: (Handle -> IO a) -> HostName -> PortNumber -> IO aSource
Send the query to a server and merge the result with the global result.
performUnsafeSendRequest :: (Handle -> IO a) -> HostName -> PortNumber -> IO aSource
performSafeSendRequest :: (Handle -> IO a) -> a -> HostName -> PortNumber -> IO aSource
performMaybeSendRequest :: (Handle -> IO a) -> HostName -> PortNumber -> IO (Maybe a)Source
Handle-Operations
putMessage :: 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.
getMessage :: 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.
data ThreadIdException Source
Constructors
ThreadIdException ThreadId
show/hide Instances
Produced by Haddock version 2.6.1