protected function _canConnect($host, $port) { $success = false; set_error_handler(function () { }); if ($conn = fsockopen($host, $port)) { fclose($conn); $success = true; } restore_error_handler(); return $success; }