private void button_init_Click(object sender, EventArgs e) { if (client != null) { client.Close(); } client = new k.KcpClient("Test".ToCharArray().Select(a => (byte)a).ToArray(), 0, "kcppeer".ToCharArray().Select(a => (byte)a).ToArray()); var arr = textBox_remote.Text.Split(":"[0]); remoteipep = new IPEndPoint(IPAddress.Parse(arr[0]), int.Parse(arr[1])); client.OnOperationResponse = (buf) => { Console.WriteLine($"{nameof(CheckBigBBuff)}={CheckBigBBuff(buf)} size:{buf.Length} "); }; client.OnConnected = (sid) => { this.Invoke( new Action(() => { this.Text = sid.ToString(); }) ); }; client.Connect(remoteipep, true); }
private void button_pingpong_init_Click(object sender, EventArgs e) { if (client != null) { client.Close(); } client = new k.KcpClient("Test".ToCharArray().Select(a => (byte)a).ToArray(), 0, "kcppeerflush".ToCharArray().Select(a => (byte)a).ToArray()); var arr = textBox_remote.Text.Split(":"[0]); remoteipep = new IPEndPoint(IPAddress.Parse(arr[0]), int.Parse(arr[1])); client.OnOperationResponse = ReqArrival; client.OnConnected = (sid) => { this.Invoke( new Action(() => { this.Text = sid.ToString(); }) ); }; withflush = checkBox_withflush.Checked == true; client.Connect(remoteipep, false); }