You're consuming three lines:
- Check if there's next line
- Printing line
- Storing one.
Noted here:
while(inFromClient.readLine()!=null) { //1.
System.out.println (inFromClient.readLine()); //2.
sb.append(inFromClient.readLine()); //3.
sb.append('\n');
}
Store the line in a String
and then do what you want/need with it:
String line = "";
while ((line = inFromClient.readLine()) != null) {
System.out.println(line);
sb.append(line);
sb.append('\n');
}