Improved UDP compatibility, fix TCP/SSL read buffer handling, improve UDP/TCP/SSL error passing

Supersedes #595. Requires tessel/firmware#104.