//同步IP void UpdateSyncIpConnect() { byte[] ipData = null; if (syncIpConnection != null) { ipData = syncIpConnection.GetMsg(); } //接受同步IP if (recvBroadCastIP == true) { if (ipData != null) { string recvIpString = Encoding.UTF8.GetString(ipData); string[] strSplit = recvIpString.Split('|'); if (strSplit.Length == 3) { string version = strSplit[0]; string ip = strSplit[1]; string group = strSplit[2]; if (version == Application.version && netGroup == group) { recvBroadCastIP = false; syncIpConnection.Dispose(); syncIpConnection = null; ConenctTcp(ip); } } } } }
public void Close() { Debug.LogWarning("关闭服务器"); host.Dispose(); host = null; if (syncIpConnection != null) { syncIpConnection.Dispose(); } }
void OnDestroy() { onBtnChange = null; if (sendUdp != null) { sendUdp.Dispose(); sendUdp = null; } if (recvUdp != null) { recvUdp.Dispose(); recvUdp = null; } }
public void Close() { if (client != null) { client.Dispose(); } if (server != null) { server.Close(); } if (multidataConnection != null) { multidataConnection.Dispose(); } if (syncIpConnection != null) { syncIpConnection.Dispose(); } }