[erlang-questions] bad rpc

prasantha kumara jlprasantha@REDACTED
Fri Nov 28 13:30:45 CET 2008


Hi all,
i wrote a program in c to call the erlang functtion .
my erlang program is sork fine when i runit seperately.
but when i tried to get the vallue through the c programe it prits the
foolowing statement which was the output tupple of the erl_rpc().
badrpc{badrpc,{'EXIT',{badarg,[{erlang,apply,[complexrpc,print,{cnode,7}]},{rpc,'-handle_call/3-fun-0-',5}]}}}�h

my c programe is as follow
/* cnode_c.c */

#include <stdio.h>
#include <sys/types.h>
//#include <sys/socket.h>
#include <arpa/inet.h>
#include "erl_interface.h"
#include "ei.h"

//#define BUFSIZE 1000
int main(int argc, char **argv) {
 int fd;
erlang_msg massage;
fd;
int n = 0;
ei_cnode ec;
  erl_init(NULL, 0);
if (erl_connect_init(1, "secretcookie", 0) == -1)
    erl_err_quit("erl_connect_init");

  if ((fd = erl_connect("e1@REDACTED")) < 0)
    erl_err_quit("erl_connect");
  fprintf(stderr, "Connected to ei@REDACTED\n\r");
if (fd<0){
}
else
{
printf("hi erlang world");
}

char* server_name;
server_name="e1@REDACTED";
ETERM *fromp, *tuplep, *fnp, *argp, *resp;
char *mod, *fun;
ETERM *args;
mod="complexrpc";
fun="print";
args = erl_format("{cnode, ~i}", 7);
fnp = erl_element(1,erl_rpc(fd,mod,fun , args));
erl_print_term(stderr,fnp);
printf("hello");
erl_print_term(stderr,erl_rpc(fd,mod,fun , args));
}
can anyone help me to fix this matter .
thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081128/3eadca47/attachment.htm>


More information about the erlang-questions mailing list