Apple over the trial there is a must through the IPv6 network test game, the first idea is to achieve two sets of socket link, the server also realized IPv6, then Baidu is actually very simple, direct dns.gethostaddresses (string hostnameoraddress) Get the link address, hostnameoraddress the domain name address, domain name binding server IP is good, the following is the complete code:
Get the remote server IP address
ipaddress[] address = dns.gethostaddresses (host);
if (address. Length = = 0)
{
Debug.logerror ("address. Length = = 0 ");
Return
}
Determine if the current network is IPv6 to establish a different link
if (Address[0]. AddressFamily = = addressfamily.internetworkv6)
{
Client = new TcpClient (ADDRESSFAMILY.INTERNETWORKV6);
}
Else
{
Client = new TcpClient (addressfamily.internetwork);
}
Establish links
Client. Nodelay = true;
try {
Client. BeginConnect (Address[0], Port, new AsyncCallback (OnConnect), null);
} catch (Exception e) {
Close (); Debug.logerror (E.message);
}
Apple over-trial IPv6 problem