EInterface¶
A C node: this side of a connection to a running Erlang/Elixir node.
One EInterface owns one connection. connect creates the node on first
use, so the node name is available before it is connected, and disconnect
closes the connection without throwing the node away. dispose releases
both, and an interface that has been disposed stays inert.
Constructors¶
create¶
new ref create(
this_nodename': String val,
cookie': String val,
creation': U32 val = 0)
: EInterface ref^
Parameters¶
Returns¶
- EInterface ref^
relay¶
A connection that arrived on another interface's listening socket.
It shares that interface's node, and holds the node until both are done with it, so neither order of disposal leaves the other with a freed node.
new ref relay(
node: Pointer[None val] ref,
connection: Connection,
peer: String val = "")
: EInterface ref^
Parameters¶
- node: Pointer[None val] ref
- connection: Connection
- peer: String val = ""
Returns¶
- EInterface ref^
Public Functions¶
connected¶
Returns¶
- Bool val
connect¶
Connects to a node, blocking until it answers.
The C library keeps process wide state, and this holds the lock over it
while it waits, so use connect_with_timeout when the other node may not
answer.
Parameters¶
- nodename: String val
Returns¶
connect_with_timeout¶
Connects to a node, giving up after timeout_ms milliseconds.
Parameters¶
Returns¶
disconnect¶
Closes the connection. The node itself stays usable for a new one.
Returns¶
- None val
publish¶
Registers this node's name with epmd and listens for connections on
port, or on a port of the system's choosing when it is zero, so that
other nodes can connect to this one.
The name is withdrawn with unpublish, or when the process ends.
Parameters¶
- port: U32 val
Returns¶
published_port¶
The port the listening socket took, and zero before publish.
Returns¶
- U32 val
unpublish¶
Closes the listening socket, so the node cannot be called any more.
The name itself is epmd's: it holds it for as long as the session the C library keeps open for it, which ends with the process, so a node of the same name cannot be published again in this process.
Returns¶
- None val
accept¶
Waits for another node to connect to this one.
Returns¶
accept_with_timeout¶
Waits up to timeout_ms for another node to connect; zero waits forever
and is the same as accept.
Parameters¶
- timeout_ms: U32 val
Returns¶
peer_nodename¶
The node at the other end of an accepted connection, and empty for a connection this interface opened itself.
Returns¶
- String val
dispose¶
Releases the connection and the node now, not when the collector runs. A disposed interface does nothing on any later call.
A published node stops listening here, so nobody can call it any more.
Returns¶
- None val
receive¶
Waits for a message.
Returns¶
receive_with_timeout¶
Waits for a message, giving up after timeout_ms; zero means wait forever
and is the same as receive.
The time is a deadline: the polls the other side sends on a quiet
connection do not start it again. Those polls are answered here, which is
what keeps the connection alive, so a connection nobody reads for longer
than the other node's net_ticktime is dropped by that node.
Parameters¶
- timeout_ms: U32 val
Returns¶
send_to¶
Sends an encoded message to a process.
Parameters¶
Returns¶
send_to_registered¶
Sends an encoded message to a process registered under a name.
fun ref send_to_registered(
server_name: String val,
what: EMessage ref,
timeout_ms: U32 val)
: SendResult
Parameters¶
Returns¶
self_pid¶
This node's own pid, as the remote node sees it.
Returns¶
- ErlangPid val ?
this_nodename¶
Returns¶
- String val
this_hostname¶
Returns¶
- String val
this_alivename¶
Returns¶
- String val
set_tracelevel¶
Parameters¶
- level: I32 val
Returns¶
- None val
get_tracelevel¶
Returns¶
- I32 val
set_compat_rel¶
Parameters¶
- rel: U32 val
Returns¶
- None val
last_error¶
The reason the last call into the C layer failed, as far as it knows.
Returns¶
- String val