use sensible buffer sizes
proper shutdown with ctrl-c in the multithreaded case
fix #127