TCP output SSL support

This fixes and improves a few things in and adds SSL support to the TCP output.