Accidenti...
si può fare che non ritorni -1 se non ci sono più dati :
l'array da leggere è inviato cosi :
codice:OutputStream out = s.getOutputStream(); byte [] richiestaInvio = new byte [1000]; richiestaInvio = cipher.doFinal(richiesta.getBytes()); out.write(richiestaInvio); out.close();