public override void Connect() { try { // Debugger.Log ("socket2 begin connect"); ReadyState = Connecting; var state = new SocketStateObject { udpClient = _udpClient, endPoint = _endPoint }; _udpClient.Connect(this._url, this._port); if (_udpClient.Connected()) { _kcp = new Kcp.Kcp(123, this); _kcp.SetOutput(OutputKcp); // fast mode _kcp.NoDelay(1, 10, 2, 1); _kcp.WndSize(1024, 1024); Timer.SetTimer(() => StartKcpUpdate(), Config.K); this.StartReceive(); ReadyState = Open; base.onOpen(); } } catch (Exception e) { Debugger.Log(e.ToString()); PushError(e); } }