Add SO_REUSEADDR option to fix testing locally.
Use @input/@output instead of STDIN/STDOUT directly.
Add a few more comments.