ConcurrentUtils-0.4.2.0: Concurrent utilities

Safe HaskellNone
LanguageHaskell98

Control.CUtils.NetChan

Description

A channel module with transparent network communication.

Synopsis

Documentation

data NetSend t Source

Instances

data NetRecv t Source

Instances

newNetChan :: Binary t => IO (NetRecv t, NetSend t) Source

Creates a new channel, with receive and send ends.

newNetSend :: HostName -> IO (NetSend t) Source

Open a channel to another host

newNetRecv :: Binary t => IO (NetRecv t) Source

Creates a receive end of this host's channel. Type unsafe!

send :: Binary t => NetSend t -> t -> IO () Source

Sends something on a channel.

recv :: Binary t => NetRecv t -> IO t Source

Receives something from a channel.

recvSend :: NetRecv (NetSend t) -> IO (NetSend t) Source

Receives the send end of a channel, on a channel.

sendRecv :: NetSend (NetRecv t) -> NetRecv t -> IO () Source

Sends the receive end of a channel, on a channel.

recvRecv :: Binary t => NetRecv (NetRecv t) -> IO (NetRecv t) Source

Receives the receive end of a channel, on a channel.

data Auth t Source

Instances

Binary (Auth t) 

authServer :: Binary t => (t -> IO ()) -> NetRecv (Auth t) -> NetSend ByteString -> PublicKey -> IO () Source

Remote exercise of authority. Commands are transmitted in the clear, but authenticated.

auth - The authority to be served (runs on a separate thread).

r - The receive end from the host.

s - The send end to the host.

publicKey - The public key of the intended recipient.

authClient :: Binary t => NetRecv ByteString -> NetSend (Auth t) -> PrivateKey -> IO (t -> IO ()) Source

privateKey - The private key for this host.

Returns a function that can be used to send messages.