ufairiya / mongoose

Automatically exported from code.google.com/p/mongoose
MIT License
0 stars 0 forks source link

Bind to ip address other then INADDR_ANY #29

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In a machine with many NICs/IPs we may need to select which local IP address 
to bind to. My sugestion is to add an option (bind_addr):
  mg_set_option(ctx, "bind_addr", "1.2.3.4")
It defaults to:
  sin_addr.s_addr = htonl(INADDR_ANY);
otherwise 
  sin_addr.s_addr = inet_addr("1.2.3.4");

Patch is trivial, let me know if you need one ... 

Best regards,
Rui

Original issue reported on code.google.com by coelho....@gmail.com on 8 Apr 2009 at 3:51

GoogleCodeExporter commented 9 years ago

Original comment by valenok on 8 Apr 2009 at 3:56

GoogleCodeExporter commented 9 years ago
Issue 32 has been merged into this issue.

Original comment by valenok on 10 Apr 2009 at 7:29

GoogleCodeExporter commented 9 years ago
Change http://code.google.com/p/mongoose/source/detail?r=311

Instead of inventing another option, I decided to expand -ports option. You can
specify an address to bind to with a "ip_address:" prefix:

mongoose -ports 192.168.1.1:8080

Marking as done.

Original comment by valenok on 11 Apr 2009 at 8:37