Hi jin,
Not sure if you want to make a chat server or echo server but below are my findings:
In Server code, below part sends message to client:
But, at client side, the code is reading that line, printing it and breaking while(true) loop (first inner loop) only if that message is stop or end. However, that message is 'Whatcha want?'. Thus, loop will not break, and client is waiting for another message from server.
Meanwhile, server is also waiting for another message from client:
I think at client side, if the message (from server) is not end/stop, then
you should give client a chance to send a message to server.
I hope this helps.
Regards,
Anayonkar Shivalkar (SCJP, SCWCD, OCMJD, OCEEJBD)