<< Prev | Beej's Guide to Network Programming | Next >> |
But I just want to know what to change in my code to get it going with IPv6! Tell me now!
Ok! Ok!
Almost everything in here is something I've gone over, above, but it's the short version for the impatient. (Of course, there is more than this, but this is what applies to the guide.)
Change INADDR_ANY assignments to in6addr_any assignments, which are slightly different:
struct sockaddr_in sa; struct sockaddr_in6 sa6; sa.sin_addr.s_addr = INADDR_ANY; // use my IPv4 address sa6.sin6_addr = in6addr_any; // use my IPv6 address
Also, the value IN6ADDR_ANY_INIT can be used as an
initializer when the
struct in6_addr ia6 = IN6ADDR_ANY_INIT;
Et voila!
<< Prev | Beej's Guide to Network Programming | Next >> |