[erlang-questions] erl_publish(port) always returns -1

Salonee Sinha Roy ssroy1979@REDACTED
Wed Feb 4 15:12:37 CET 2009


Hi All
I am trying to write a C node and call erl_publish in the C code. However
this function always returns -1. I am trying to find the possible reasons
for this. Would really appreciate it if someone could educate me on this. My
code is below

 int sockfd;

  ErlConnect erlc;
  int fd;
  int identification_number = 1;
  int creation=1;
  char *cookie="cookie"; /* An example */
  string errcom;
  int port = atoi(argv[1]);
  printf("THe port is %d,",port);

  try {
    erl_init(NULL, 0);

    if (erl_connect_init(identification_number, cookie,creation) == -1)
      erl_err_quit("erl_connect_init");

    //fprintf(stderr, "connected\n");
    if ((sockfd = my_listen(PORT)) <= 0)
      erl_err_quit("error: my_listen");

    // fprintf(stderr, "listening\n");
    printf("PORT is %d",PORT);
    if ( erl_publish(PORT) == -1)
      erl_err_quit("error: publish");
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090204/3927a32c/attachment.htm>


More information about the erlang-questions mailing list