Reduce write system calls, thus fewer TCP packets

Do a bit more copying around in user space before handing off
the data to the kernel, so that

Before this change, one connect, publish and disconnect
was 19 packets. After this change, it is 14 packets.
Ethernet/IP/TCP overhead is about 66 bytes. So with this
change, we use 73% of the bandwidth as before
(14*66/19*66 = 0.73).
Merge pull request #3 from jeffallen/master

Reduce write system calls, thus fewer TCP packets