Read Integer with BufferedReader on Android

0

In an Android Application, I have a socket client java that sends integers (using writeInt) to a socket server on Android that I am trying to read these integers. I get strings correctly but can not convert when using parseInt, Here and Here .

In this piece of code I try to read using read (), but it always returns zero, I translate the various reader that contains integer return but I could not understand if someone with experience can help and say which method is used to read the integer ...

conexao = welcomeSocket.accept();



    BufferedReader inFromClient = new BufferedReader(new InputStreamReader( conexao.getInputStream() ));

    clientSentence = inFromClient.read(); //retorna zero


    Bundle b = new Bundle();
    b.putInt("resposta", clientSentence);

    rr.send(1, b);

    } catch(Exception e ){

    } 
    
asked by anonymous 06.10.2017 / 03:27

0 answers