| Core/NetworkPackage/GameNetSystem.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
| Core/NetworkPackage/Socket/ClientSocketController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
Core/NetworkPackage/GameNetSystem.cs
@@ -15,9 +15,11 @@ DisconnectState disconnectState; NetState m_NetState; public NetState netState { public NetState netState { get { return this.m_NetState; } set { set { if (this.m_NetState != value) { switch (m_NetState) @@ -99,9 +101,16 @@ public void BeginConnectGameServer(string _ip, int _port, Action _onConnected) { if (socketController != null && socketController.Connected) try { socketController.CloseConnect(); if (socketController != null && socketController.Connected) { socketController.CloseConnect(); } } catch (System.Exception ex) { DebugEx.Log(ex); } socketController = new ClientSocketController(); Core/NetworkPackage/Socket/ClientSocketController.cs
@@ -9,7 +9,8 @@ public class ClientSocketController { Socket m_Socket; public Socket socket { public Socket socket { get { return m_Socket; } } @@ -114,16 +115,31 @@ /// </summary> public void CloseConnect() { isStopTreading = true; if (m_packageThread != null) try { m_packageThread.Abort(); isStopTreading = true; if (m_packageThread != null) { m_packageThread.Abort(); } } catch (System.Exception ex) { DebugEx.Log(ex); } if (m_Socket != null && m_Socket.Connected) try { m_Socket.Shutdown(SocketShutdown.Both); m_Socket.Close(); if (m_Socket != null && m_Socket.Connected) { m_Socket.Shutdown(SocketShutdown.Both); m_Socket.Close(); } } catch (System.Exception ex) { DebugEx.Log(ex); } sendQueue.Clear();