Library to support network programming with sockets that are addressed
by symbolic names. In contrast to raw sockets (see library Socket
),
this library uses the Curry Port Name Server
to provide sockets that are addressed by symbolic names
rather than numbers.
In standard applications, the server side uses the operations
listenOn
and socketAccept
to provide some service
on a named socket, and the client side uses the operation
connectToSocket
to request a service.
Author: Michael Hanus
Version: March 2021
listenOn
:: String -> IO Socket
Creates a server side socket with a symbolic name. |
socketAccept
:: Socket -> IO (String,Handle)
Returns a connection of a client to a socket. |
waitForSocketAccept
:: Socket -> Int -> IO (Maybe (String,Handle))
Waits until a connection of a client to a socket is available. |
sClose
:: Socket -> IO ()
Closes a server socket. |
socketName
:: Socket -> String
Returns a the symbolic name of a named socket. |
connectToSocketRepeat
:: Int -> IO a -> Int -> String -> IO (Maybe Handle)
Waits for connection to a Unix socket with a symbolic name. |
connectToSocketWait
:: String -> IO Handle
Waits for connection to a Unix socket with a symbolic name and return the handle of the connection. |
connectToSocket
:: String -> IO Handle
Creates a new connection to an existing(!) Unix socket with a symbolic name. |
Abstract type for named sockets.
Constructors:
Returns a connection of a client to a socket. The connection is returned as a pair consisting of a string identifying the client (the format of this string is implementation-dependent) and a handle to a stream communication with the client. The handle is both readable and writable. |
Waits until a connection of a client to a socket is available. If no connection is available within the time limit, it returns Nothing, otherwise the connection is returned as a pair consisting of a string identifying the client (the format of this string is implementation-dependent) and a handle to a stream communication with the client.
|
Returns a the symbolic name of a named socket.
|
Waits for connection to a Unix socket with a symbolic name.
In contrast to
|
Waits for connection to a Unix socket with a symbolic name and return the handle of the connection. This action waits (possibly forever) until the socket with the symbolic name is registered.
|
Creates a new connection to an existing(!) Unix socket with a symbolic name. If the symbolic name is not registered, an error is reported.
|