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

Roberto Ostinelli roberto@REDACTED
Fri Apr 24 17:52:00 CEST 2009


i haven't tried that, will take a look at it.

thank you,

r.


On 24/apr/09, at 17:39, Pablo Polvorin wrote:

> Have you tried the ei_* API instead?,
> (http://erlang.org/doc/apps/erl_interface/index.html)
> ei has a number of advantages,  I think it is the preferred way to
> write c code,
>
>
>
> 2009/4/24 robbie13 <roberto@REDACTED>:
>>
>> 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.
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://www.erlang.org/mailman/listinfo/erlang-questions
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>




More information about the erlang-questions mailing list