Struct erl_dist::epmd::EpmdClient [] [src]

pub struct EpmdClient { /* fields omitted */ }

EPMD client.

This implements the client side of the EPMD protocol.

Examples

Queries the information of the "foo" node:

use fibers::{Executor, InPlaceExecutor, Spawn};
use fibers::net::TcpStream;
use futures::Future;
use erl_dist::epmd::{DEFAULT_EPMD_PORT, EpmdClient};

let epmd_addr = format!("127.0.0.1:{}", DEFAULT_EPMD_PORT).parse().unwrap();
let target_node = "foo";
let mut executor = InPlaceExecutor::new().unwrap();

// Queries the node information asynchronously.
let monitor = executor.spawn_monitor(TcpStream::connect(epmd_addr)
    .and_then(move |socket| EpmdClient::new().get_node_info(socket, target_node)));
let result = executor.run_fiber(monitor).unwrap();

match result {
    Err(e) => println!("Failed: {}", e),
    Ok(None) => println!("Not found:"),
    Ok(Some(info)) => println!("Found: {:?}", info),
}

See epmd_cli.rs file for more comprehensive examples.

Methods

impl EpmdClient
[src]

Makes a new EpmdClient instance.

Registers a node in the EPMD connected by stream.

The connection created to the EPMD must be kept as long as the node is a distributed node. When the connection is closed, the node is automatically unregistered from the EPMD.

Note

For executing asynchronously, we assume that stream returns the std::io::ErrorKind::WouldBlock error if an I/O operation would be about to block.

Queries the distribution port (and other information) of the node_name node to the EPMD connected by stream.

If the node has not been registered in the EPMD, this will return None.

Note

For executing asynchronously, we assume that stream returns the std::io::ErrorKind::WouldBlock error if an I/O operation would be about to block.

Kills the EPMD connected by stream.

This request kills the running EPMD. It is almost never used.

If the EPMD is killed, it will returns "OK".

Note

For executing asynchronously, we assume that stream returns the std::io::ErrorKind::WouldBlock error if an I/O operation would be about to block.

Gets all registered names from the EPMD connected by stream.

The result value is a string written for each active node. The format of each entry is "name ${NODE_NAME} at port ${PORT}\n".

Note

For executing asynchronously, we assume that stream returns the std::io::ErrorKind::WouldBlock error if an I/O operation would be about to block.

Dumps all data from the EPMD connected by stream.

This request is not really used, it is to be regarded as a debug feature.

The result value is a string written for each node kept in the EPMD.

The format of each entry is

"active name ${NODE_NAME} at port ${PORT}, fd = ${FD}\n"

or

"old/unused name ${NODE_NAME} at port ${PORT}, fd = ${FD}\n"

Note

For executing asynchronously, we assume that stream returns the std::io::ErrorKind::WouldBlock error if an I/O operation would be about to block.

Trait Implementations

impl Debug for EpmdClient
[src]

Formats the value using the given formatter.