I'm messing around with a project that involves a "C" Nodes. I spent several hours trying to get it to connect, but no dice. Finally, before I went to bed, I tried connecting via the port number with erl_call and the toy echo program worked. Huzzah! But now the question remains: Why wouldn't Erlang/Elixir want to connect to the "C" Node, but erl_call would via address? (The program is actually Rust using C bindings, but that shouldn't change anything. I can post the source if desired)
#C Nodes
1 messages · Page 1 of 1 (latest)
Could you show us some code? Also - this is called "C Nodes" not "C Hosts". Have you tried working through documentation?
Whoopsies, misremembered the name. I did try working through the documentation, and the Rust code is pretty 1:1.
pub fn main() {
init().unwrap();
let mut me = Node::init(c"ket@toolbox", Some(c"uwuowoawa")).unwrap();
println!("Initialized");
let socket = TcpListener::bind("0.0.0.0:0").unwrap();
let port = socket.local_addr().unwrap().port();
let socket_fd = socket.as_raw_fd();
me.publish(port).unwrap();
println!("Preparing to accept");
let conn = me.accept(&mut ListeningPort { inner: socket_fd }).unwrap();
let mut buffer = Buffer::new().unwrap();
if let Ok(Some(msg)) = conn.receive(&mut buffer) {
match msg {
Message::RegSend { from } => {
conn.send(&from, &buffer).unwrap();
}
_ => {}
}
}
}
}
}
C Nodes
Most of the code came from here
https://www.erlang.org/docs/26/apps/erl_interface/ei_users_guide
I can see it registering in the EMPD with -debug mode, and, to further complicate the matter, it works when connecting via the port with erl_call