Put another way, if an address is IPv4, why bother to express it as IPv6 at all?
It’s IPv4 expressed through IPv6 so that the application only needs to support one IP stack.
Being able to reference IPv4 addresses through IPv6 notation means I can work on getting IPv6 support really solid in my application, and not have to worry about duplicating effort.
These days some distributions disable IPv4 compatibility by default (e.g. Debian), and also Windows does this by default. To accommodate this as a programmer you should bind two sockets: one IPv4 socket, and one IPv6 socket with the IPV6_V6ONLY
flag (which forces it to bind IPv6–only with no IPv4 compatibility, no matter the state of /proc/sys/net/ipv6/bindv6only
).
In the comments below, Mike linked me to this great site with info on how you should use sockaddr_storage for AF_–independent programming (which has great relevance whether you decide to go AF_INET6, or decide to use AF_INET and AF_INET6 side by side). Also I like Beej's Guide to Network Programming, which has some similar information too. Recommended reading. Thanks, Mike!