Try to use GDB to find you problem issue.<br><br><div><span class="gmail_quote">On 31/01/2008, <b class="gmail_sendername">Mukul J</b> <<a href="mailto:mukul.j@tcs.com">mukul.j@tcs.com</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">

<br><font face="sans-serif" size="2">Hi, </font>
<br>
<br><font face="sans-serif" size="2">I am doing the same thing with the below
mentioed code.</font>
<span class="q"><br>
<br><font face="sans-serif" size="2">#include "erl_interface.h"</font>
<br><font face="sans-serif" size="2">#include "ei.h"</font>
<br>
<br></span><font face="sans-serif" size="2">int main()</font>
<br><font face="sans-serif" size="2">{</font>
<br><font face="sans-serif" size="2">        extern const
char *erl_thisnodename(void);</font>
<br><font face="sans-serif" size="2">        extern short
erl_thiscreation(void);</font>
<br>
<br><font face="sans-serif" size="2">        #define
SELF(fd) erl_mk_pid(erl_thisnodename(),fd,0,erl_thiscreation())</font>
<br>
<br><font face="sans-serif" size="2">        ETERM *arr[2],
*emsg;</font>
<br><font face="sans-serif" size="2">        int sockfd,
creation=1;</font>
<br><font face="sans-serif" size="2">        int i;</font>
<br><font face="sans-serif" size="2">        char buf[BUFSIZ];</font>
<br>
<br><font face="sans-serif" size="2">        erl_init(NULL,0);</font>
<br><font face="sans-serif" size="2">        arr[0] =
SELF(sockfd);</font>
<br><font face="sans-serif" size="2">        arr[1] =
erl_mk_atom("Hello world");</font>
<br><font face="sans-serif" size="2">        emsg = erl_mk_tuple(arr,
2);</font>
<br><font face="sans-serif" size="2">        i = erl_encode(emsg
, buf);</font>
<br>
<br><font face="sans-serif" size="2">        erl_reg_send(sockfd,
"my_server", emsg);</font>
<br><font face="sans-serif" size="2">        erl_free_term(emsg);</font>
<br><font face="sans-serif" size="2">}</font>
<br>
<br><font face="sans-serif" size="2">I am getting some different error. </font>
<br>
<br><font face="sans-serif" size="2">ERROR: Segmentation fault</font>
<br>
<br><font face="sans-serif" size="2">Please advise where i am doing wrong.
</font>
<br>
<br><font face="sans-serif" size="2">Regards,<br>
Mukul Jain</font>
<br>
<br>
<br>
<table width="100%">
<tbody><tr valign="top">
<td width="40%"><font face="sans-serif" size="1"><b>J Bhanot <<a href="mailto:j.bhanot@tcs.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">j.bhanot@tcs.com</a>></b>
</font>
<br><font face="sans-serif" size="1">Sent by: <a href="mailto:erlang-questions-bounces@erlang.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">erlang-questions-bounces@erlang.org</a></font>
<p><font face="sans-serif" size="1">01/30/2008 07:46 PM</font>
</p></td><td width="59%">
<table width="100%">
<tbody><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">To</font></div>
</td><td><font face="sans-serif" size="1"><a href="mailto:erlang-questions@erlang.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">erlang-questions@erlang.org</a></font>
</td></tr><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">cc</font></div>
</td><td>
<br></td></tr><tr valign="top">
<td>
<div align="right"><font face="sans-serif" size="1">Subject</font></div>
</td><td><font face="sans-serif" size="1">[erlang-questions] Node name for erl_connect(nodename)</font></td></tr></tbody></table>
<br>
<table>
<tbody><tr valign="top">
<td>
<br></td><td><br></td></tr></tbody></table>
<br></td></tr></tbody></table><div><span class="e" id="q_117ce5d4bd44d212_3">
<br>
<br>
<br><font face="sans-serif" size="2"><br>
Hi,</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><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 face="sans-serif" size="2"><br>
Now i have written a small program in C which uses erl_interface...</font><font size="3">
<br>
</font><font face="sans-serif" size="2"><br>
[code]</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><br>
#include <stdio.h></font><font size="3"> </font><font face="sans-serif" size="2"><br>
//#include <inet.h></font><font size="3"> </font><font face="sans-serif" size="2"><br>
#include <erl_interface.h></font><font size="3"> </font><font face="sans-serif" size="2"><br>
#include <ei.h></font><font size="3"> <br>
<br>
</font><font face="sans-serif" size="2"><br>
main()</font><font size="3"> </font><font face="sans-serif" size="2"><br>
{</font><font size="3"> </font><font face="sans-serif" size="2"><br>
printf("Heloo World\n");</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><br>
 erl_init(NULL,0);</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><br>
//int identification_number = 99;</font><font size="3"> </font><font face="sans-serif" size="2"><br>
//int creation=1;</font><font size="3"> </font><font face="sans-serif" size="2"><br>
//char *cookie="a secret cookie string"; /* An example */</font><font size="3">
<br>
</font><font face="sans-serif" size="2"><br>
if (!erl_connect_init(17, "samplecookiestring...", 0))</font><font size="3">
</font><font face="sans-serif" size="2"><br>
  erl_err_quit("<ERROR> when initializing !");</font><font size="3">
<br>
</font><font face="sans-serif" size="2"><br>
int sockfd;</font><font size="3"> </font><font face="sans-serif" size="2"><br>
char *nodename="<a href="mailto:c17@a.DNS.name" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">c17@a.DNS.name</a>"; /* An example */</font><font size="3">
</font><font face="sans-serif" size="2"><br>
//char *nodename="<a href="http://127.0.0.1" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">127.0.0.1</a>"; /* An example */</font><font size="3">
</font><font face="sans-serif" size="2"><br>
if ((sockfd = erl_connect(nodename)) < 0)</font><font size="3"> </font><font face="sans-serif" size="2"><br>
{</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><br>
printf("in\n");</font><font size="3"> </font><font face="sans-serif" size="2"><br>
erl_err_quit("ERROR: erl_connect failed");</font><font size="3">
</font><font face="sans-serif" size="2"><br>
}</font><font size="3"> </font><font face="sans-serif" size="2"><br>
else</font><font size="3"> </font><font face="sans-serif" size="2"><br>
{</font><font size="3"> </font><font face="sans-serif" size="2"><br>
printf("got the conn");</font><font size="3"> </font><font face="sans-serif" size="2"><br>
}</font><font size="3"> </font><font face="sans-serif" size="2"><br>
}</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><br>
[/code]</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><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 face="sans-serif" size="2"><br>
but i am really confused about the node name to be given in erl_connect(nodename)</font><font size="3">
<br>
</font><font face="sans-serif" size="2"><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 face="sans-serif" size="2"><br>
but not able to connect it and getting the error </font><font size="3"><br>
</font><font face="sans-serif" size="2"><br>
ERROR: erl_connect failed</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><br>
Any clues on that..</font><font size="3"> <br>
</font><font face="sans-serif" size="2"><br>
Thanks,</font><font size="3"> </font><font face="sans-serif" size="2"><br>
jb<br>
____________________________________________</font>
<br></span></div><font size="3"><tt></tt></font><div><span class="e" id="q_117ce5d4bd44d212_5"><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></span></div><font size="3"><tt>
</tt></font><font size="2"><tt>_______________________________________________<br>
erlang-questions mailing list<br>
<a href="mailto:erlang-questions@erlang.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">erlang-questions@erlang.org</a><br>
<a href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.erlang.org/mailman/listinfo/erlang-questions</a></tt></font>
<br><font color="white" face="sans-serif" size="1">ForwardSourceID:NT000184D6
   </font>
<div><span class="e" id="q_117ce5d4bd44d212_7"><br><pre>=====-----=====-----=====<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></pre></span></div><br>_______________________________________________<br>
erlang-questions mailing list<br><a onclick="return top.js.OpenExtLink(window,event,this)" href="mailto:erlang-questions@erlang.org">erlang-questions@erlang.org</a><br><a onclick="return top.js.OpenExtLink(window,event,this)" href="http://www.erlang.org/mailman/listinfo/erlang-questions" target="_blank">http://www.erlang.org/mailman/listinfo/erlang-questions</a><br>
</blockquote></div><br><br clear="all"><br>-- <br>Maxim Treskin