Example #1
0
        private void SendSingleCommand2(string command)
        {
            TCPConnection tcp = new TCPConnection(txtIP.Text, Convert.ToUInt16(txtPort.Text));

            byte[] bytesToSend = new byte[5000];
            bytesToSend = GetBytes(command);

            byte[] receivedBytes = new byte[10000];
            receivedBytes = tcp.RequestData(bytesToSend);

            if (receivedBytes == null)
            {
                dgvLogs.Rows.Add(selectedItem.ToString(), DateTime.Now.ToString(), "Gelen byte dizisi null.");
                return;
            }

            txtReceivedBytes.Clear();
            for (int i = 0; i < 100; i++)
            {
                txtReceivedBytes.Text += receivedBytes[i].ToString() + ",";
            }

            txtReceivedBytesASCII.Text = ASCIIEncoding.ASCII.GetString(receivedBytes);
        }