ipv6 when embedding mongoose

257 views
Skip to first unread message

rbl...@gmail.com

unread,
Mar 2, 2015, 8:17:29 AM3/2/15
to mongoos...@googlegroups.com
Hi,

I'm using mongoose following the embeded mongoose example from https://github.com/cesanta/mongoose/blob/master/docs/Embed.md
I'm working on Linux.

Here the code excerpt of the main function:
  struct mg_server *server = mg_create_server(NULL, event_handler);
  mg_set_option(server, "document_root", ".");      // Serve current directory
  mg_set_option(server, "listening_port", "8080");  // Open port 8080
  for (;;) {
    mg_poll_server(server, 1000);   // Infinite loop, Ctrl-C to stop
  }
  mg_destroy_server(&server);

I need to have the server listen in IPV6. I've read about the -DUSE_IPV6 flag, but it doesn't seem to work for my case.
I've also read about using net_skeleton, but I don't seem to have it locally nor to find its definitive online location (found fossa instead).

What is the correct way to make server listen to IPV6?

Thanks

Raph

rbl...@gmail.com

unread,
Mar 2, 2015, 9:00:51 AM3/2/15
to mongoos...@googlegroups.com

Looking at the code in mongoose.c, I saw that when you set a port to listen to, it will only work with ipv4.
Changing this part to use ipv6 made the trick for me.

 

Thanks

Raph

Sergey Lyubka

unread,
Mar 8, 2015, 9:16:50 AM3/8/15
to mongoose-users
There is -DNS_ENABLE_IPV6 , documented at https://github.com/cesanta/mongoose/blob/master/docs/Embed.md

--
You received this message because you are subscribed to the Google Groups "mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongoose-user...@googlegroups.com.
To post to this group, send email to mongoos...@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages