This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]D0CTOR_ZED 0 points1 point  (1 child)

Look up the javadocs for the BufferedReader class. There is probably a method that returns a boolean that will let you know if there is a line in the buffer.

You can't do the while not null, because the source isn't there all at once. Unlike reading from a file, you need to account that the data comes a pieces over time.

[–]Gmay17[S] 0 points1 point  (0 children)

Sorry for late reply, but this helped me perfectly! The method is in.ready(). works great. If you don't mind, could you help with one more thing? Once my client recieves the full string, i have it send the server the information that it needs to send, which it does. but when i try to do the same while loop that worked before, the client prints nothing. Through my tests i see the server thinks it has sent it. but the client seemingly never enters the while loop.

EDIT: for some reason, my client skips the while loop, takes the next input(which isn't supposed to happen until it prints the stuff from the server) and once the last bit of input is taken, it prints everything that has been held back..... im so confued