In a loop, this code runs (server side):
try {
BufferedInputStream is = new BufferedInputStream(cnn.getInputStream());
InputStreamReader isr = new InputStreamReader(is);
int character;
StringBuffer process = new StringBuffer();
while ( (character = isr.read()) != 13) {
process.append( (char) character);
}
println("Input: " + process.toString());
} catch (Exception e) { }
the client is not sending anything, but process.toString() outputs infinite question marks.
the variable is outputs this: java.io.InputStreamReader@510ebe18 (the last number always changes)
Isn't the input supposed to be empty and fall back to catch block if the client doesn't send anything?
What am i doing wrong?
note: the while-loop goes on forever because there is no end to the input, i was able to see the question marks comming out by putting a limit of 100 characters to the process variable.
isr.read()will keep on returning -1... Oh, and printing the result ofInputStreamReader.toString()is never going to do anything useful.