// public bool Connect(string address, int port, ConnectionType type) { try { Debug.Log("Addrss:" + address + " port:" + port + " type:" + type.ToString()); bool ret = true; if (type == ConnectionType.TCP || type == ConnectionType.Both) { // 도달을 보장하는 TCP 통신을 시작합니다. if (m_tcp == null) { m_tcp = new TransportTcp(); m_tcp.RegisterEventHandler(OnEventHandling); } ret &= m_tcp.Connect(address, port); } if (type == ConnectionType.UDP || type == ConnectionType.Both) { // 도달을 보장하지 않는 UDP 통신을 시작합니다. if (m_udp == null) { m_udp = new TransportUdp(); m_udp.RegisterEventHandler(OnEventHandling); } ret &= m_udp.Connect(address, port); } if (ret == false) { if (m_tcp != null) { m_tcp.Disconnect(); } if (m_udp != null) { m_udp.Disconnect(); } return(false); } } catch { return(false); } return(LaunchThread()); }