void OnDestroy() { if (null != client) { client.Stop(); } }
public void Connect(string host, int port) { if (null != client) { client.Stop(); } client = new MyKcp(); client.NoDelay(1, 10, 2, 1);//fast client.WndSize(4096, 4096); client.Timeout(40 * 1000); client.SetMtu(512); client.SetMinRto(10); client.SetConv(121106); client.Connect(host, port); client.Start(); }