Add work/result batching; use blocking sockets when possible.

fixes #47.  fixes #46