java - Send signal to av receiver with android -


i want implement function in android app turn on/off av receiver. therefore created socket , send command via telnet receiver, nothing happens. socket created successfully!

my av receiver denon x-2000 , according official protocol have send pwstandby command.

 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();   } 

ok found solution myself, changed line

out.println("pwstandby"); 

to

out.print("pwstandby\r"); 

and works.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -