[erlang-questions] Problems in erl_accept
Fri Feb 1 09:23:23 CET 2008
I had to publish my C node and then it was being shown in Erlang node by
executing this command:
but now when i want it to accept connection - I have added following
memset((char *) &remote, 0, sizeof(remote));
if(erl_accept(sockfd, &remote) == ERL_ERROR)
where remote is declared at the top as
and sockfd is the same socket which I have used in connecting to Erlang
node, binding/listening and have made this port as non blocking as well
but now when I execute code for C node..
I am getting following error:
accept: Bad file descriptor
Any ideas on that..
02/01/2008 12:01 AM
"J Bhanot" <j.bhanot@REDACTED>, erlang-questions@REDACTED
Re: [erlang-questions] Erlang C Communication - process completes but
nodes are not connected
This is my first post to this list, so i'm sorry for any mistakes :)
IIRC, C nodes are hidden nodes, hence net_adm:world() will not show
them. Use nodes(hidden). to list hidden nodes.
On 1/31/08, J Bhanot <j.bhanot@REDACTED> wrote:
> I am using C node as client
> #include <stdio.h>
> #include <signal.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <arpa/inet.h>
> #include <sys/fcntl.h>
> #include "erl_interface.h"
> #include "ei.h"
> #define PORT 6666
> int sockfd, epmdfd;
> struct in_addr addr;
> erl_init(NULL, 0);
> printf("Initializing ...");
> if(!erl_connect_init(69, "SFEWRG34AFDSGAFG35235", 0))
> printf("\nerror in initialisation");
> printf("\nafter error in init");
> printf(" done.\n");
> printf("node=%s, host=%s, alive=%s, creation=%d\n ",
> erl_thisnodename(), erl_thishostname(),
> erl_thisalivename(), erl_thiscreation());
> /*This is the short host name outgoing connect routine */
> printf("Connecting ...");
> getchar(); //for checking
> if((sockfd = erl_connect("node1@REDACTED")) < 0)
> // if((sockfd = erl_connect("")) < 0)
> printf("in error");
> printf("\nsock = %d\n", sockfd);
> printf(" done.\n");
> and Erlang node as server 'node1@REDACTED'
> Steps to run Erlang node :
> erl -setcookie SFEWRG34AFDSGAFG35235 -name node1
> Created a file named $HOME/.hosts.erlang having contents as
> The output for c file upon execution is
> [root@REDACTED otp_src_R12B-0]# ./mytest
> Initializing ... done.
> node=c69@REDACTED, host=localhost, alive=c69, creation=0
> Connecting ...
> sock = 3
> erl_connect: Success
> but at erlang node when i execute the command :
> (node1@REDACTED)8> net_adm:world().
> i get the output as :
> (node1@REDACTED)9> nodes().
> That is no node is connected to it....
> Now the point is C node has successfully connected ....
> Why Erlang node is not showing it as connected....
> Do we need to register the C node with EPMD even when it is acting as a
> Do we need to register Erlang node with EPMD as well and if yes the how
> we do that..
> Note : I am using putty to connect to single linux server (FC8).
> Appreciate your help...
> Many Thanks,
> Notice: The information contained in this e-mail
> message and/or attachments to it may contain
> confidential or privileged information. If you are
> not the intended recipient, any dissemination, use,
> review, distribution, printing or copying of the
> information contained in this e-mail message
> and/or attachments to it are strictly prohibited. If
> you have received this communication in error,
> please notify us by reply e-mail or telephone and
> immediately and permanently delete the message
> and any attachments. Thank you
"Only two things are infinite, the universe and human stupidity, and
I'm not sure about the former."
-- Albert Einstein
Notice: The information contained in this e-mail
message and/or attachments to it may contain
confidential or privileged information. If you are
not the intended recipient, any dissemination, use,
review, distribution, printing or copying of the
information contained in this e-mail message
and/or attachments to it are strictly prohibited. If
you have received this communication in error,
please notify us by reply e-mail or telephone and
immediately and permanently delete the message
and any attachments. Thank you
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions