Test socket validity by comparing to TR_BAD_SOCKET instead of various (and sometimes wrong) other tests like `x >= 0`, `x != -1`, `x > 0`, `x > -1`, `x` (valid), and `x < 0`, `x == -1` (invalid).