protected function _closeSocket() {
        if ($this->debug_) {
            error_log("Closing socket.");
        }

        $fd = $this->socket_;
        if (is_resource($fd)) {
            $this->socket_ = null;
            @fclose($fd);
        }
    }