private void button1_Click(object sender, EventArgs e) { SDKClient client = new SDKClient("192.168.3.196", 10261, "qcu1", "", "lq", "lq", 0); var flag = client.openConnection(); while (true) { try { client.sendMessage(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); } catch (Exception ex) { Debug.WriteLine(ex.Message); } finally { Thread.Sleep(1000); } } }