[erlang-questions] cannot send messages to a C-node

robbie13 roberto@REDACTED
Fri Apr 24 16:58:02 CEST 2009


hi all,

i cannot find a way to send messages to an erlang c-node. i create the
c-node with the following:

------------------------------------------
struct in_addr addr; 
addr.s_addr = inet_addr("127.0.0.1");
if (erl_connect_xinit("rob.loc", "http_cnode", "http_cnode@REDACTED", &addr,
"secretcookie", 0) == -1)
	erl_err_quit("erl_connect_xinit");
if (erl_connect("http@REDACTED") == -1)
	erl_err_quit("erl_connect");
------------------------------------------
rob.loc is configured in my /etc/hosts file to point to 127.0.0.1.

i do get connected, and as i can see from my http@REDACTED erlang shell:
------------------------------------------
(http@REDACTED)21> nodes(hidden).                         
['http_cnode@REDACTED']
------------------------------------------

the code i have to receive messages is the typical:
------------------------------------------
unsigned char buf[BUFSIZE];              /* Buffer for incoming message */
ErlMessage emsg;                         /* Incoming message */

while (1) {
	fprintf(stderr, "start\n\r");
	got = erl_receive_msg(fd, buf, BUFSIZE, &emsg);
	fprintf(stderr, "GOT MESSAGE\n\r");
	if (got == ERL_TICK) {
		continue;
	...
------------------------------------------

if i send a message to the node:
------------------------------------------
(http@REDACTED)22> {any, http_cnode@REDACTED} ! {test, "hello!"}.
{test, "hello!"}
------------------------------------------
the code of the c-node never gets to the GOT MESSAGE printout.

instead, if i initialize the c-node with:
------------------------------------------
if (erl_connect_init(1, "secretcookie", 0) == -1)
	erl_err_quit("erl_connect_init");
if ((fd = erl_connect("http@REDACTED")) < 0)
	erl_err_quit("erl_connect");
------------------------------------------
everything works correctly, but i cannot specify an hostname for the c-node.

any kind soul would have a clue to this? thank you in advance..

r.
-- 
View this message in context: http://www.nabble.com/cannot-send-messages-to-a-C-node-tp23218139p23218139.html
Sent from the Erlang Questions mailing list archive at Nabble.com.




More information about the erlang-questions mailing list