Both ends are reading until EOS and neither is closing until after that. So you have a classic deadlock. You need to rethink your application protocol.
You also need to tell your PrintStream
or PrintWriter
to autoflush, or else call flush()
yourself, but this is a relatively minor matter compared to the mistake above.