Drop sockets

Replace sockets by streams, these are simpler to use and better supported.

Two other minor changes: rename ServerIP for clarity (DNS names are also supported) and include a reason for connection failures.