// 连接 private void button1_Click(object sender, EventArgs e) { LongConnectionUtil.getInstance().Connection(m_netListen); this.button_lianjie.Enabled = false; this.button_duankai.Enabled = true; this.button_fasong.Enabled = true; }
// 断开 private void button3_Click(object sender, EventArgs e) { this.button_lianjie.Enabled = true; this.button_duankai.Enabled = false; this.button_fasong.Enabled = false; LongConnectionUtil.getInstance().stopConncetion(); }
public static LongConnectionUtil getInstance() { if (s_instance == null) { s_instance = new LongConnectionUtil(); } return(s_instance); }
// 发送 private void button2_Click(object sender, EventArgs e) { string backData = this.textBox_send.Text; this.textBox_send.Text = ""; this.listBox_chat.Items.Add(" " + backData); LongConnectionUtil.getInstance().sendmessage(backData); }
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { Debug.WriteLine("窗口关闭"); LongConnectionUtil.getInstance().stopConncetion(); }