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: November 2018

Summary of exported operations:

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

Exported operations:

cpnsStart :: IO ()   

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 ()   

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

cpnsStop :: IO ()   

Terminates the local CPNS demon

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

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)   

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 ()   

Unregisters a symbolic port at the local host.

cpnsAlive :: String -> IO Bool   

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