Module Network.CPNS

Implementation of a Curry Port Name Server based on raw sockets. It is used to implement the library Network.NamedPorts and the library Ports for distributed programming with ports.

Author: Michael Hanus

Version: March 2021

Summary of exported operations:

cpnsStart :: IO ()  Non-deterministic 
Starts the "Curry Port Name Server" (CPNS) running on the local machine.
cpnsStatus :: IO ()  Non-deterministic 
Shows all registered ports at the local CPNS demon (in its logfile).
cpnsStop :: IO ()  Deterministic 
Terminates the local CPNS demon
registerPort :: String -> Int -> Int -> IO ()  Non-deterministic 
Registers a symbolic port at the local host.
getPortInfo :: String -> String -> IO (Int,Int)  Non-deterministic 
Gets the information about a symbolic port (first argument) at some host (second argument).
unregisterPort :: String -> IO ()  Deterministic 
Unregisters a symbolic port at the local host.
cpnsAlive :: String -> IO Bool  Deterministic 
Tests whether the CPNS demon at a host is alive, i.e., reacts on Ping message.

Exported operations:

cpnsStart :: IO ()  Non-deterministic 

Starts the "Curry Port Name Server" (CPNS) running on the local machine. The CPNS is responsible to resolve symbolic names for ports into physical socket numbers so that a port can be reached under its symbolic name from any machine in the world.

cpnsStatus :: IO ()  Non-deterministic 

Shows all registered ports at the local CPNS demon (in its logfile).

cpnsStop :: IO ()  Deterministic 

Terminates the local CPNS demon

registerPort :: String -> Int -> Int -> IO ()  Non-deterministic 

Registers a symbolic port at the local host. The symbolic name, the socket number, and the port number are passed as arguments.

getPortInfo :: String -> String -> IO (Int,Int)  Non-deterministic 

Gets the information about a symbolic port (first argument) at some host (second argument). If there is no registration, (0,0) is returned, otherwise a pair consisting of a socket and port number.

unregisterPort :: String -> IO ()  Deterministic 

Unregisters a symbolic port at the local host.

cpnsAlive :: String -> IO Bool  Deterministic 

Tests whether the CPNS demon at a host is alive, i.e., reacts on Ping message.