[Fwd: Re: Binding to an IP]

Joe Orton joe at manyfish.co.uk
Wed Mar 25 11:41:00 EDT 2009


On Wed, Mar 25, 2009 at 10:29:29AM -0500, Bryan Duff wrote:
>    ne_inet_addr *addr = ne_iaddr_make(ne_iaddr_ipv4, "192.168.1.2");
>    ne_set_localaddr(session, addr);

Ah - there's no API in neon to convert from a numeric IP address to an 
inet_addr object like that, though it would be nice to add.

ne_iaddr_make takes raw byte representation, see examples at:

http://www.webdav.org/neon/doc/html/refiaddr.html

to convert from "192.168.1.2" you'd have to either call inet_ntop 
directly or use:

   ne_sock_addr *sa = ne_addr_resolve("192.168.1.2", 0);

   if (ne_addr_result(sa)) abort();

   ne_set_localaddr(sess, ne_addr_first(sa));

Regards, Joe




More information about the neon mailing list