From 47fa2fccdc320dfca98afd54cd60c6982a867840 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期四, 10 九月 2020 00:42:35 +0800
Subject: [PATCH] 0312 修复升星跳转背包BUG,装备分解红点只会在点击背包按钮时才有优先跳转,其他情况不跳转; 去除登录时域名的异步解析,产生的问题弹框现象1. 网络超时 2.版本资源异常

---
 Core/NetworkPackage/Socket/ClientSocket.cs |   38 +++++++++++++++++++++++++++++++++++++-
 1 files changed, 37 insertions(+), 1 deletions(-)

diff --git a/Core/NetworkPackage/Socket/ClientSocket.cs b/Core/NetworkPackage/Socket/ClientSocket.cs
index 8bf796c..759fb3f 100644
--- a/Core/NetworkPackage/Socket/ClientSocket.cs
+++ b/Core/NetworkPackage/Socket/ClientSocket.cs
@@ -42,12 +42,47 @@
             ip = _ip;
             port = _port;
             onConnected = _onConnected;
-            Dns.BeginGetHostAddresses(_ip, OnGetHostAddresses, null);
+            //鐩墠娴嬭瘯鍒板紓姝ヤ袱涓棶棰�
+            // 1. BeginGetHostAddresses 涓嶆槑鎯呭喌涓嬩細寰堜箙鎵嶅洖璋冿紝瀵艰嚧瑙﹀彂瓒呮椂
+            // 2. 瓒呮椂鐨勬儏鍐典笅澶氭灏濊瘯鐧诲綍鍚庯紝浼氳Е鍙戝娆nGetHostAddresses锛屽鑷寸櫥褰曞紓甯�
+            //Dns.BeginGetHostAddresses(_ip, OnGetHostAddresses, null);
+            
+            IPAddress ipAddress;
+            #if UNITY_IPHONE
+            IPHostEntry ipAddresses = Dns.GetHostEntry(_ip);
+            ipAddress = ipAddresses.AddressList[0];
+            
+            #else 
+            IPAddress[] ipAddresses = Dns.GetHostAddresses(_ip);
+            ipAddress = ipAddresses[0];
+            #endif      
+    
+
+            if (ipAddress.AddressFamily == AddressFamily.InterNetworkV6)
+            {
+                DebugEx.Log("褰撳墠浣跨敤鐨勭綉缁�: IPV6");
+                m_Socket = new Socket(AddressFamily.InterNetworkV6, SocketType.Stream, ProtocolType.Tcp);
+            }
+            else
+            {
+                DebugEx.Log("褰撳墠浣跨敤鐨勭綉缁�: IPV4");
+                m_Socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
+            }
+
+            var ipEndPoint = new IPEndPoint(ipAddress, port);
+            if (ipEndPoint == null)
+            {
+                Debug.Log("IpEndPoint is null");
+            }
+
+            m_Socket.BeginConnect(ipEndPoint, new AsyncCallback(ConnectCallBack), null);
         }
         catch (Exception e)
         {
             DebugEx.LogError(e.Message);
         }
+
+
     }
 
     private void OnGetHostAddresses(IAsyncResult _result)
@@ -130,6 +165,7 @@
     /// </summary>
     public void CloseConnect()
     {
+        Debug.Log("==== CloseConnect");
         try
         {
             isStopTreading = true;

--
Gitblit v1.8.0