<br><font size=2 face="sans-serif">Hi, </font>
<br>
<br><font size=2 face="sans-serif">I am doing the same thing with the below
mentioed code.</font>
<br>
<br><font size=2 face="sans-serif">#include "erl_interface.h"</font>
<br><font size=2 face="sans-serif">#include "ei.h"</font>
<br>
<br><font size=2 face="sans-serif">int main()</font>
<br><font size=2 face="sans-serif">{</font>
<br><font size=2 face="sans-serif">        extern const
char *erl_thisnodename(void);</font>
<br><font size=2 face="sans-serif">        extern short
erl_thiscreation(void);</font>
<br>
<br><font size=2 face="sans-serif">        #define
SELF(fd) erl_mk_pid(erl_thisnodename(),fd,0,erl_thiscreation())</font>
<br>
<br><font size=2 face="sans-serif">        ETERM *arr[2],
*emsg;</font>
<br><font size=2 face="sans-serif">        int sockfd,
creation=1;</font>
<br><font size=2 face="sans-serif">        int i;</font>
<br><font size=2 face="sans-serif">        char buf[BUFSIZ];</font>
<br>
<br><font size=2 face="sans-serif">        erl_init(NULL,0);</font>
<br><font size=2 face="sans-serif">        arr[0] =
SELF(sockfd);</font>
<br><font size=2 face="sans-serif">        arr[1] =
erl_mk_atom("Hello world");</font>
<br><font size=2 face="sans-serif">        emsg = erl_mk_tuple(arr,
2);</font>
<br><font size=2 face="sans-serif">        i = erl_encode(emsg
, buf);</font>
<br>
<br><font size=2 face="sans-serif">        erl_reg_send(sockfd,
"my_server", emsg);</font>
<br><font size=2 face="sans-serif">        erl_free_term(emsg);</font>
<br><font size=2 face="sans-serif">}</font>
<br>
<br><font size=2 face="sans-serif">I am getting some different error. </font>
<br>
<br><font size=2 face="sans-serif">ERROR: Segmentation fault</font>
<br>
<br><font size=2 face="sans-serif">Please advise where i am doing wrong.
</font>
<br>
<br><font size=2 face="sans-serif">Regards,<br>
Mukul Jain</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>J Bhanot <j.bhanot@tcs.com></b>
</font>
<br><font size=1 face="sans-serif">Sent by: erlang-questions-bounces@erlang.org</font>
<p><font size=1 face="sans-serif">01/30/2008 07:46 PM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">erlang-questions@erlang.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">[erlang-questions] Node name for erl_connect(nodename)</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><font size=2 face="sans-serif"><br>
Hi,</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
I am using putty to connect to my linux server....am also runnig MGC (sample
application in Megaco) which is listening on the port of linux server...</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
Now i have written a small program in C which uses erl_interface...</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
[code]</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
#include <stdio.h></font><font size=3> </font><font size=2 face="sans-serif"><br>
//#include <inet.h></font><font size=3> </font><font size=2 face="sans-serif"><br>
#include <erl_interface.h></font><font size=3> </font><font size=2 face="sans-serif"><br>
#include <ei.h></font><font size=3> <br>
<br>
</font><font size=2 face="sans-serif"><br>
main()</font><font size=3> </font><font size=2 face="sans-serif"><br>
{</font><font size=3> </font><font size=2 face="sans-serif"><br>
printf("Heloo World\n");</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
 erl_init(NULL,0);</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
//int identification_number = 99;</font><font size=3> </font><font size=2 face="sans-serif"><br>
//int creation=1;</font><font size=3> </font><font size=2 face="sans-serif"><br>
//char *cookie="a secret cookie string"; /* An example */</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
if (!erl_connect_init(17, "samplecookiestring...", 0))</font><font size=3>
</font><font size=2 face="sans-serif"><br>
  erl_err_quit("<ERROR> when initializing !");</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
int sockfd;</font><font size=3> </font><font size=2 face="sans-serif"><br>
char *nodename="c17@a.DNS.name"; /* An example */</font><font size=3>
</font><font size=2 face="sans-serif"><br>
//char *nodename="127.0.0.1"; /* An example */</font><font size=3>
</font><font size=2 face="sans-serif"><br>
if ((sockfd = erl_connect(nodename)) < 0)</font><font size=3> </font><font size=2 face="sans-serif"><br>
{</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
printf("in\n");</font><font size=3> </font><font size=2 face="sans-serif"><br>
erl_err_quit("ERROR: erl_connect failed");</font><font size=3>
</font><font size=2 face="sans-serif"><br>
}</font><font size=3> </font><font size=2 face="sans-serif"><br>
else</font><font size=3> </font><font size=2 face="sans-serif"><br>
{</font><font size=3> </font><font size=2 face="sans-serif"><br>
printf("got the conn");</font><font size=3> </font><font size=2 face="sans-serif"><br>
}</font><font size=3> </font><font size=2 face="sans-serif"><br>
}</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
[/code]</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
I am trying to connect to erlang node i.e. running MGC using this....(i
hope my understanding is right here)</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
but i am really confused about the node name to be given in erl_connect(nodename)</font><font size=3>
<br>
</font><font size=2 face="sans-serif"><br>
I have tried given it 127.0.0.1....also 127.0.0.1...also 127.0.01:2944(port
on which MGC is listeniing)</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
but not able to connect it and getting the error </font><font size=3><br>
</font><font size=2 face="sans-serif"><br>
ERROR: erl_connect failed</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Any clues on that..</font><font size=3> <br>
</font><font size=2 face="sans-serif"><br>
Thanks,</font><font size=3> </font><font size=2 face="sans-serif"><br>
jb<br>
____________________________________________</font>
<br><font size=3><tt>=====-----=====-----=====<br>
Notice: The information contained in this e-mail<br>
message and/or attachments to it may contain <br>
confidential or privileged information. If you are <br>
not the intended recipient, any dissemination, use, <br>
review, distribution, printing or copying of the <br>
information contained in this e-mail message <br>
and/or attachments to it are strictly prohibited. If <br>
you have received this communication in error, <br>
please notify us by reply e-mail or telephone and <br>
immediately and permanently delete the message <br>
and any attachments. Thank you<br>
<br>
<br>
</tt></font><font size=2><tt>_______________________________________________<br>
erlang-questions mailing list<br>
erlang-questions@erlang.org<br>
http://www.erlang.org/mailman/listinfo/erlang-questions</tt></font>
<br><font size=1 color=white face="sans-serif">ForwardSourceID:NT000184D6
   </font>
<br><pre>=====-----=====-----=====
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


</pre>