[java] How to get ALL the information from a socket
- by raven
Hello,
I'll begin this question with the claim that I have read the java networking guide before asking you.
I do not understand how to READ the socket and get all the info summed up into a string.
the socket might contains more than 1 line [trying to make a chat].
Please do no refer me to any other site unless it clearly states "this exact line does this.."
because I failed to understand what this code part does
BufferedReader stdIn = new BufferedReader(
new InputStreamReader(System.in));
String userInput;
while ((userInput = stdIn.readLine()) != null) {
out.println(userInput);
System.out.println("echo: " + in.readLine());
}
Please, I just want to make a loop that will receive information from a socket, get all the content together into one string [I also want it to know where to add another line].
Thanks allot for anyone who helps, I have been trying to get an answer from tuts for hours and just failed to understand!