Send "connect" control message

Chuck Swiger cswiger at mac.com
Tue Apr 6 17:41:50 UTC 2010


Hi--

On Apr 6, 2010, at 8:32 AM, serena zanetta wrote:
> But first of all, I don't know how I can convert the IP_REMOTE, which is
> currently IP_REMOTE = "10.0.0.90", into a in_addr structure...

To convert a string to an IP address kept as an in_addr, you want inet_aton(), used like so:

    const char *ipstr = "127.0.0.1";
    struct in_addr ip;

    if (!inet_aton(ipstr, &ip))
        errx(1, "can't parse IP address %s", ipstr);

[ Example borrowed from "man gethostbyaddr" ]

Regards,
-- 
-Chuck



More information about the freebsd-net mailing list