//Send Text Data To The Selected Client
        #region private void TextBox_Input_Send_to_Client_KeyDown(object sender, KeyEventArgs e)
        private void TextBox_Input_Send_to_Client_KeyDown(object sender, KeyEventArgs e)
        {
            if (TextBox_Remote_Client_IP.Text == "")
            {
                MessageBox.Show("Error: Pleas Enter Client IP To Send it", "Error at RemoteEndPoint IP ", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            if (clientSendRequset.Client.Connected)
            {
                if ((e.KeyCode == Keys.Enter))
                {
                    clientSendRequset.Writer = new BinaryWriter(clientSendRequset.MynetworkStream);

                    //1
                    clientSendRequset.Writer.Write((byte)3);                       // 3 is falg That means : the Cleint Wants To Send  To  Selected Client By IP Address
                    //2
                    clientSendRequset.Writer.Write(TextBox_Remote_Client_IP.Text); // Very Important : Send IP Address of Client You Want To Send to it

                    //3 : Sending  Text Data
                    clientSendRequset.Writer.Write("client>>" + TextBox_Input_Send_to_Client.Text);

                    TextBox_Input.Clear();
                }
            }
            else
            {
                // MessageBox.Show("Client is Diconnected");
                TextBox_Input.Clear();
            }
        }
        //Send Text Data To The Server
        #region private void TextBox_input_KeyDown(object sender, KeyEventArgs e)
        private void TextBox_input_KeyDown(object sender, KeyEventArgs e)
        {
            if (clientSendRequset.Client.Connected)
            {
                if ((e.KeyCode == Keys.Enter))
                {
                    clientSendRequset.Writer = new BinaryWriter(clientSendRequset.MynetworkStream);

                    clientSendRequset.Writer.Write((byte)0);                         // 0 is Flag that Represent that the Client Send text Data

                    clientSendRequset.Writer.Write("client>>" + TextBox_Input.Text); // Send Text Data

                    TextBox_Input.Clear();
                }
            }
            else
            {
                // MessageBox.Show("Client is Diconnected");
                TextBox_Input.Clear();
            }
        }
Exemple #3
0
 private void ClearInput()
 {
     TextBox_Input.Clear();
     TextBox_Input.Focus();
 }