Пример #1
0
        private void btnSend_Click(object sender, EventArgs e)
        {
            sw = new Socket_wrapper(txtIP.Text, int.Parse(txtPort.Text));

            sw.socket_send(txtMsg.Text);

            /*
             *        if (client.Connected )
             *        {
             *            byte[] buffer = Encoding.UTF8.GetBytes(txtMsg.Text);
             *            //client.BeginSend()
             *            client.Send(buffer);
             *            //
             *        }*/
        }
Пример #2
0
        void mySocketReceive(object obj)
        {
            Socket_wrapper sw1 = obj as Socket_wrapper;

            byte[] buffer1 = new byte[1024 * 1024];
            string s       = sw1.socket_receive(buffer1);
            //txtInfo.AppendText(s);
            dShowMsg d1 = new dShowMsg(showMsg);

            if (txtInfo.InvokeRequired)
            {
                txtInfo.Invoke(d1, s);
            }
            else
            {
                txtInfo.AppendText(s);
            }
        }