|
On the client wrap System.in in a BufferedReader. Then loop on in.readLine(). Each time you get a line from the command line send it down the socket and call flush but, don't call close().
On the server loop around dataIn.readLine like so.
while (message=dataIn.readLine() != null)
Again leave the socket open.
To end the program and socket look for a keyword on the client like "exit" that will then end the loop and close the socket.
On the server the readLine will either return null or an exception will be thrown and it can end as well.
|