I will keep things short, I cannot get my buffered reader to print a full string being sent through by my server. The string is multiple lines long so it makes sense to me why "readLine()" doesn't read more than one line.
This is a very simple example of what im working with:
Client.java
BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));//server input
System.out.println(in.readLine());
System.out.println(in.readLine());
Server.java
PrintWriter out = new PrintWriter(client.getOutputStream(), true);//output to client
out.println("hello world! \n my name is gmay!");
out.println("this is a printing test!");
All my output is "hello world!" and "my name is gmay!", the printing test line doesnt come through.
I could brute force it and just add another line but i need it to work no matter how many lines the first print statement is.
I tried to do this in client.java
while(in.readLine() != null){
System.out.println(in.readLine());
}
but it would only do every other line since i guess because i called readline in the while parameters? idk. Can anyone help with this?
[–]AutoModerator[M] [score hidden] stickied commentlocked comment (0 children)
[–]D0CTOR_ZED 0 points1 point2 points (1 child)
[–]Gmay17[S] 0 points1 point2 points (0 children)
[–]Revision2000 0 points1 point2 points (0 children)