title: Send signal to av receiver with android
body: <p>i want to implement a function in my android app to turn on/off my av receiver.
  Therefore i created a socket and send a command via Telnet to the receiver, but nothing happens.
  The Socket is created successfully!</p>
  
  <p>My av receiver is a Denon x-2000 and according to the official protocol I have to send a PWSTANDBY command.</p>
  
  <pre><code> public void turnOff(View v){
      Runnable r = new Runnable() {
  
          @Override
          public void run() {
              Socket s = null;
              PrintWriter out = null;
              BufferedReader in= null;
              try{
                  InetAddress ia = InetAddress.getByName("192.168.100.228");
                  s= new Socket(ia, 23);
                  out = new PrintWriter(s.getOutputStream(), true);
                  in = new BufferedReader(new InputStreamReader(s.getInputStream()));
              } catch(IOException e){
  
              }
              Log.v("output","send standby");
              out.println("PWSTANDBY");
              out.flush();
  
              try {
                  if(in.ready())
                  Log.v("input", in.readLine());
  
              } catch (IOException e) {
                  e.printStackTrace();
              }
  
              out.close();
              try {
                  in.close();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
              try {
                  s.close();
              } catch (IOException e) {
                  // TODO Auto-generated catch block
                  e.printStackTrace();
              }
          }
      };
  
      Thread t = new Thread(r);
      t.start();
  
  
  }
  </code></pre>