private void detectarDedada(object sender, KeyEventArgs e)
        {
            switch (tanqueLocal)
            {
            case 1:
                Tanque1.Botoes(e.KeyCode.ToString());
                server.recebeTecla(e.KeyCode.ToString());
                break;

            case 2:
                Tanque2.Botoes(e.KeyCode.ToString());
                client.recebeTecla(e.KeyCode.ToString());
                break;
            }
        }
        void recebeComandos()
        {
            try
            {
                stream = client.GetStream();
                var totalBytesReceived = 0;

                while (true)
                {
                    var buffer        = new byte[BUFFER_SIZE];
                    var bytesReceived = stream.Read(buffer, 0, BUFFER_SIZE);
                    Tanque.Botoes(Encoding.ASCII.GetString(buffer, totalBytesReceived, bytesReceived));

                    if (TeclaPressionada != null)
                    {
                        var bytesToSend = Encoding.ASCII.GetBytes(TeclaPressionada);

                        stream.Write(bytesToSend, 0, bytesToSend.Length);
                        TeclaPressionada = null;
                    }
                    else
                    {
                        stream.Write(new byte[2], totalBytesReceived, 2);
                    }


                    //totalBytesReceived += bytesReceived;
                    // if (bytesReceived != BUFFER_SIZE) break;
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.ToString());
            }
            finally
            {
                stream.Close();
                client.Close();
            }
        }
        public void roda()
        {
            var stream = client.GetStream();

            while (true)
            {
                if (TeclaPressionada != null)
                {
                    var bytesToSend = Encoding.ASCII.GetBytes(TeclaPressionada);

                    stream.Write(bytesToSend, 0, bytesToSend.Length);

                    TeclaPressionada = null;
                }
                else
                {
                    stream.Write(new byte[2], 0, 2);
                }
                var buffer = new byte[BUFFER_SIZE];

                var bytesReceived = stream.Read(buffer, 0, BUFFER_SIZE);
                Tanque.Botoes(Encoding.ASCII.GetString(buffer, 0, bytesReceived));
            }
        }