[erlang-questions] up-to-date c node not working

James Churchman jameschurchman@REDACTED
Thu Jun 7 00:40:12 CEST 2012

Hi Everyone

So the instructions for writing a c-node here
http://www.erlang.org/doc/tutorial/cnode.html , although still working are
way out of date ( they don't use the newer ei_connect
http://www.erlang.org/doc/man/ei_connect.html )

I can get the older example code working well but can't however get the
newer ones going .. doing some google-ing it seems people as far back as
2005 have the same issue but nowhere can i find a fix.

As far as i can tell i can successfully connect to a running Erlang node (
"e1@REDACTED" ) like so :

ei_cnode ec;

if (ei_connect_init(&ec, "e1", "secretcookie", n++) < 0)

int fd = ei_connect(&ec, "e1@REDACTED");
    printf("ei_connect error : %d",fd);

seems to work fine, and defiantly fails if i get the cookie wrong etc..

what does not work tho is trying to receive a message :

ei_x_buff x;

if (ei_xreceive_msg(fd, &msg, &x) > 0)
    // do something

what ever i try ei_xreceive_msg returns -1 .. if it's in a loop (as similar
code found on the net) it will loop non stop and consume 95 % cpu time

is there something simple i am doing wrong ?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20120606/61d84c8f/attachment.htm>

More information about the erlang-questions mailing list