Fix command-line parsing.
Support both server and client pipes.
Support reading from pipe.