revised to use Streamreader/Streamwriter pair in lieu of socket.