Add full support to IPv6, large chunk of code was copied from GCDAsyncSocket