[erlang-questions] Node name for erl_connect(nodename)

Mukul J mukul.j@REDACTED
Thu Jan 31 06:35:31 CET 2008


Hi, 

I am doing the same thing with the below mentioed code.

#include "erl_interface.h"
#include "ei.h"

int main()
{
        extern const char *erl_thisnodename(void);
        extern short erl_thiscreation(void);

        #define SELF(fd) 
erl_mk_pid(erl_thisnodename(),fd,0,erl_thiscreation())

        ETERM *arr[2], *emsg;
        int sockfd, creation=1;
        int i;
        char buf[BUFSIZ];

        erl_init(NULL,0);
        arr[0] = SELF(sockfd);
        arr[1] = erl_mk_atom("Hello world");
        emsg = erl_mk_tuple(arr, 2);
        i = erl_encode(emsg , buf);

        erl_reg_send(sockfd, "my_server", emsg);
        erl_free_term(emsg);
}

I am getting some different error. 

ERROR: Segmentation fault

Please advise where i am doing wrong. 

Regards,
Mukul Jain



J Bhanot <j.bhanot@REDACTED> 
Sent by: erlang-questions-bounces@REDACTED
01/30/2008 07:46 PM

To
erlang-questions@REDACTED
cc

Subject
[erlang-questions] Node name for erl_connect(nodename)







Hi, 

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... 

Now i have written a small program in C which uses erl_interface... 

[code] 

#include <stdio.h> 
//#include <inet.h> 
#include <erl_interface.h> 
#include <ei.h> 


main() 
{ 
printf("Heloo World\n"); 

 erl_init(NULL,0); 

//int identification_number = 99; 
//int creation=1; 
//char *cookie="a secret cookie string"; /* An example */ 

if (!erl_connect_init(17, "samplecookiestring...", 0)) 
  erl_err_quit("<ERROR> when initializing !"); 

int sockfd; 
char *nodename="c17@REDACTED"; /* An example */ 
//char *nodename="127.0.0.1"; /* An example */ 
if ((sockfd = erl_connect(nodename)) < 0) 
{ 

printf("in\n"); 
erl_err_quit("ERROR: erl_connect failed"); 
} 
else 
{ 
printf("got the conn"); 
} 
} 

[/code] 

I am trying to connect to erlang node i.e. running MGC using this....(i 
hope my understanding is right here) 

but i am really confused about the node name to be given in 
erl_connect(nodename) 

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) 

but not able to connect it and getting the error 

ERROR: erl_connect failed 

Any clues on that.. 

Thanks, 
jb
____________________________________________
=====-----=====-----=====
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


_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions
ForwardSourceID:NT000184D6 
=====-----=====-----=====
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...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080131/ce114d08/attachment.htm>


More information about the erlang-questions mailing list