String line;BufferedReader br = new BufferedReader(new InputStreamReader(socket.getInputStream()));while((line = br.readLine()) != null){ //}