fix ipv6 issue

reference https://bitcointalk.org/index.php?topic=106236.msg1175793#msg1175793