Tweaked error handling.
Added option to disable nagle algorithm