Adds IPv6 and MDNS domain name resolution.

These changes are the old MDNS updates that I submitted a long time ago but never seemed to make it in. They've been updated a bit to work better, but these should probably get merged upstream at some point.