Replace sockets with streams

sockets are not enabled in a default PHP installation (it requires
the --enable-sockets option at compile time). streams are default
since PHP 4.3.0, so let's use that for compatibility reasons. IPv4,
IPv6 and host names are still supported.
Rename ServerIP for clarity

The "IP" symbol can also refer to DNS names besides IP addresses.
Include error message on connection failure
Prevent possible infinite loop

If the server returned too few data, the script would hang waiting for
more. Detect no data and abort.
Check for timeout on ping response read

Fix another possible DoS vector where the server spits one byte at a
time.
Merge pull request #75 from Lekensteyn/drop-sockets

Drop sockets