コード例 #1
0
 // 连接
 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;
 }
コード例 #2
0
        // 断开
        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();
        }
コード例 #3
0
    public static LongConnectionUtil getInstance()
    {
        if (s_instance == null)
        {
            s_instance = new LongConnectionUtil();
        }

        return(s_instance);
    }
コード例 #4
0
        // 发送
        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);
        }
コード例 #5
0
 private void Form1_FormClosing(object sender, FormClosingEventArgs e)
 {
     Debug.WriteLine("窗口关闭");
     LongConnectionUtil.getInstance().stopConncetion();
 }