This module enables C-programs to communicate with Erlang nodes, using the Erlang distribution over TCP/IP.
A C-node appears to Erlang as a hidden node.
That is, Erlang processes that know the name of the
C-node can communicate with it in a normal manner, but
the node name is not shown in the listing provided by
The environment variable
Most functions appear in a version with the suffix
Clearly the time-outs are for implementing fault tolerance,
not to keep hard real-time promises. The
A time-out value of
As with all other functions starting with
In all other senses, the
Convenience functions for some common name lookup functions.
Used by a server process to accept a connection from a client process.
On success,
Equivalent to
Sets up a connection to an Erlang node.
These functions return an open file descriptor on success, or
a negative value indicating that an error occurred. In the latter
case they set
Also,
Example:
Initializes the
A C-node acting as a server is assigned a creation
number when it calls
A connection is closed by simply closing the socket. For information about how to close the socket gracefully (when there are outgoing packets before close), see the relevant system documentation.
These functions return a negative value indicating that an error occurred.
Example 1:
Example 2:
Equivalent to
Used to set tracing on the distribution. The levels are different
verbosity levels. A higher level means more information. See also
section
These functions are not thread safe.
Used by a server process to register
with the local name server EPMD, thereby allowing
other processes to send messages by using the registered name.
Before calling either of these functions, the process should
have called
To unregister with EPMD, simply close the returned descriptor. Do
not use
On success, the function returns a descriptor connecting the
calling process to EPMD. On failure,
Also,
Equivalent to
Receives a message consisting of a sequence of bytes in the Erlang external format.
If a tick occurs, that is, the Erlang node on the
other end of the connection has polled this node to see if it
is still alive, the function returns
On success, the message is placed in the specified buffer
and the function returns the number of bytes actually read. On
failure, the function returns
This function is retained for compatibility with code generated by the interface compiler and with code following examples in the same application.
In essence, the function performs the same operation as
Returns either
It is recommended to use
Equivalent to
Receives a message to the buffer in
On success, the functions return
Indicates that an ordinary send operation has occurred.
A registered send operation occurred.
Indicates a broken link.
The return value is the same as for
Equivalent to
Equivalent to
Sends an Erlang term to a registered process.
Returns
Example:
Send the atom "ok" to the process "worker":
Equivalent to
Supports calling Erlang functions on remote nodes.
Example:
Check to see if an Erlang process is alive:
Retrieves the pid of the C-node. Every C-node
has a (pseudo) pid used in
Sends an Erlang term to a process.
Returns
Works exactly as
Equivalent to
This function is retained for compatibility with code generated by the interface compiler and with code following examples in the same application.
The function works as
A suitable
num = fd;
]]>
Equivalent to
Equivalent to
Can be used to retrieve information about
the C-node. These values are initially set with
These function simply fetch the appropriate field from the
Can be called by a process to unregister a
specified node from EPMD on the local host. This is, however, usually
not allowed, unless EPMD was started with flag
To unregister a node you have published, you should
close the descriptor that was returned by
This function is deprecated and will be removed in a future release.
If the node was successfully unregistered from EPMD, the
function returns
Equivalent to
If a connection attempt fails, the following can be checked:
The connection attempt can be traced by setting a trace level by either
using