sock_send_string and sock_send "corrected" to handle cases where not all
the bytes intended to be sent are actually sent (must loop to
send the remaining bytes).
File descriptors were not actually being closed by sock_close (they were
only being shutdown).