Erlang/OTP Forums

Author Message

<  Open Telecom Platform (OTP)  ~  Cnode can't get a message from an erlang node

oddi
Posted: Wed Mar 24, 2010 8:14 am Reply with quote
Joined: 24 Mar 2010 Posts: 1
Hello,

I'm a newbie in Erlang Cnode prograaming and I have some questions relateted with communications between a CNode and an ordinary Erlang node.

I have a simple CNode client program, like this (in fact it have been copied from Erl_Interface manual)

Code:
int main(int argc, char **argv) {
  int fd;                                  /* fd to Erlang node */
  int loop = 1;                            /* Loop flag */
  int got;                                 /* Result of receive */
  unsigned char buf[BUFSIZE];              /* Buffer for incoming message */
  ErlMessage emsg;                         /* Incoming message */
  ETERM *fromp, *tuplep, *fnp, *argp, *resp;
  int res;
 
  erl_init(NULL, 0);
  if (erl_connect_init(1, "secretcookie", 0) == -1)
    erl_err_quit("erl_connect_init");
  if ((fd = erl_connect("e1@idril")) < 0)
    erl_err_quit("erl_connect");
  fprintf(stderr, "Connected to e1@idril\n\r");
  while (loop) {
    got = erl_receive_msg(fd, buf, BUFSIZE, &emsg);
    if (got == ERL_TICK) {
      /* ignore */
    } else if (got == ERL_ERROR) {
      loop = 0;
    } else {
      if (emsg.type == ERL_REG_SEND) {
   printf("I have got a message!\n");
      }
    }
  }
}


Also, I have running erlang node "e1@idril" with cookie set to secretcookie.

Despite the fact that this client is pretty simple, I have troubles with it.
1. I'm very confused, that erl_connect() returns 0. I tried to change parameters for erl_connect_init, but I always had fd set to 0. However, e1@idrill node can see this cnode, i.e. command nodes(hidden) shows c1@idrill
2.Command erl_receive_msg() stucks, i.e. it doesn't return any value ant the client stuck on it.
3.After some time my erlang node rejects the connection from the cnode and I can see the following output in erl shell:
"Node c1@idriil not responding"
"Removing (timeouted) connection"

I'm working on GNU/Linux and have R13 OTP version installed.
Could you please me tofigure out, why my cnode doesn't work? Thank you for assistance.

/Dmitry
View user's profile Send private message ICQ Number
wuji
Posted: Wed Aug 15, 2012 6:21 am Reply with quote
User Joined: 10 Aug 2012 Posts: 654
will always be remembered for her intelligence, beauty, compassion, humor humor cheap Ralph Lauren humor and her kind heart," her family wrote in her
Secret Addiction: Stepping Out of Adderall's ShadowBetween 2002 and 2010, 2010, designer replica *beep* 2010, a 750 Percent Increase in Adderall Prescriptions for
26 to 39By DAN HARRIS and LANA ZAKJune 26, 2012 2012 cheap Ralph Lauren Polo 2012 All over America there are moms in the shadows
in their daily responsibilities and turning to the prescription drug drug replica designer *beep* drug Adderall for relief.Adderall is a drug for attention deficit
disorder, but these women don't have ADHD; they say they they [h2]cheap Ralph Lauren Polo[/h2] they need Adderall to be better mothers.Between 2002 and 2010,
been a 750 percent increase in Adderall prescriptions for women women [h3]discount designer *beep*[/h3] women between 26 and 39. Critics say clearly not all
View user's profile Send private message

Display posts from previous:  

All times are GMT
Page 1 of 1
This forum is locked: you cannot post, reply to, or edit topics.

Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum