Determine whether these attributes refer to a socket.

@return boolean
344504
public boolean isSocket() {
		if (permissions != null
				&& (permissions.longValue() & SftpFileAttributes.S_IFSOCK) == SftpFileAttributes.S_IFSOCK) {
			return true;
		}
		return false;
	}
118716
def _is_socket(cls, stream):
        """"""
        try:
            fd = stream.fileno()
        except ValueError:
            # If it has no file descriptor, it's not a socket
            return False

        sock = socket.fromfd(fd, socket.AF_INET, socket.SOCK_RAW)
        try:
            # This will raise a socket.error if it's not a socket
            sock.getsockopt(socket.SOL_SOCKET, socket.SO_TYPE)
        except socket.error as ex:
            if ex.args[0] != errno.ENOTSOCK:
                # It must be a socket
                return True
        else:
            # If an exception wasn't raised, it's a socket
            return True
669447
public function set_blocking()
    {
        if (!$this->socket || !is_resource($this->socket)) return false;
        Debug::Log(Debug::DEBUG, 'SOCKET: blocking mode: ON');
        stream_set_blocking($this->socket, true);
        return true;
    }
354111
function recv()
    {
        if (!$this->handshake)
        {
            trigger_error("not complete handshake.");
            return false;
        }
        if ($this->buffer and  $offset = stripos($this->buffer,"\r\n\r\n") !== false)
        {
            $packet = substr($this->buffer, 0, $offset + 4);
            $next = substr($this->buffer, $offset + 4);
            if ($next) {
                $this->buffer = $next;
            }
            $this->parser->push($packet);
            $frame = $this->parser->pop();
            if ($frame)
            {
                return $frame->data;
            }
        } else {
            while (true)
            {
                $data = $this->socket->recv();
                if ($this->buffer) {
                    $data = $this->buffer.$data;
                    $this->buffer = '';
                }
                if (!$data)
                {
                    return false;
                }
                $this->parser->push($data);
                $frame = $this->parser->pop();
                if ($frame)
                {
                    return $frame->data;
                }
            }
        }
        return false;
    }
483380
public function Ping( )
		{
			if( !$this->Connected )
			{
				throw new SocketException( 'Not connected.', SocketException::NOT_CONNECTED );
			}
			
			$this->Socket->Write( self::A2S_PING );
			$Buffer = $this->Socket->Read( );
			
			return $Buffer->GetByte( ) === self::S2A_PING;
		}
804470
public function is()
    {
        $patterns = func_get_args();

        $name = $this->currentRouteName();

        foreach ($patterns as $pattern) {
            if (Str::is($pattern, $this->currentRouteName())) {
                return true;
            }
        }

        return false;
    }
834075
function isConnected() {
		try {
			return $this->connection->isOpen();
		} catch (SmtpException $ex) {
			$this->log('EOF caught while checking if connected', 'client');
			$this->close();
		}
		return false;
	}
682126
public function bindSocket()
    {
        $sock = socket_create(AF_INET, SOCK_DGRAM, SOL_UDP);
        if (!$sock) {
            $errno = socket_last_error();
            Daemon::$process->log(get_class($this) . ': Couldn\'t create UDP-socket (' . $errno . ' - ' . socket_strerror($errno) . ').');
            return false;
        }
        if (!isset($this->port)) {
            if (isset($this->defaultPort)) {
                $this->port = $this->defaultPort;
            } else {
                Daemon::log(get_class($this) . ' (' . get_class($this->pool) . '): no port defined for \'' . $this->uri['uri'] . '\'');
            }
        }
        if ($this->reuse) {
            if (!socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1)) {
                $errno = socket_last_error();
                Daemon::$process->log(get_class($this) . ': Couldn\'t set option REUSEADDR to socket (' . $errno . ' - ' . socket_strerror($errno) . ').');
                return false;
            }
            if (defined('SO_REUSEPORT') && !@socket_set_option($sock, SOL_SOCKET, SO_REUSEPORT, 1)) {
                $errno = socket_last_error();
                Daemon::$process->log(get_class($this) . ': Couldn\'t set option REUSEPORT to socket (' . $errno . ' - ' . socket_strerror($errno) . ').');
                return false;
            }
        }
        if (!@socket_bind($sock, $this->host, $this->port)) {
            $errno = socket_last_error();
            $addr = $this->host . ':' . $this->port;
            Daemon::$process->log(get_class($this) . ': Couldn\'t bind UDP-socket \'' . $addr . '\' (' . $errno . ' - ' . socket_strerror($errno) . ').');
            return false;
        }
        socket_getsockname($sock, $this->host, $this->port);
        $addr = $this->host . ':' . $this->port;
        socket_set_nonblock($sock);
        $this->setFd($sock);
        return true;
    }
937429
protected function connect()
    {
        $rs = false;

        foreach ((array)$this->server as $svr) {
            $error = 0;
            $errstr = '';
            $rs = @fsockopen($svr['host'], $svr['port'], $error, $errstr);

            if ($rs) {
                $this->socket = $rs;

            } else {
                $key = $this->getServerKey(
                    $svr['host'],
                    $svr['port'],
                    $svr['weight']
                );
                $s = "Connect to $key error:" . PHP_EOL .
                    "    [$error] $errstr";
                error_log($s);
            }
        }

        if (is_null($this->socket)) {
            $this->resultCode = Memcached::RES_FAILURE;
            $this->resultMessage = 'No server avaliable.';
            return false;

        } else {
            $this->resultCode = Memcached::RES_SUCCESS;
            $this->resultMessage = '';
            return true;
        }
    }
131477
public function isReferral()
    {
        if ( ! isset($this->referer)) {
            if (empty($_SERVER[ 'HTTP_REFERER' ])) {
                $this->referer = false;
            } else {
                $referer_host = @parse_url($_SERVER[ 'HTTP_REFERER' ], PHP_URL_HOST);
                $own_host = parse_url(base_url(), PHP_URL_HOST);

                $this->referer = ($referer_host && $referer_host !== $own_host);
            }
        }

        return $this->referer;
    }
745835
public function isConnectionClose()
    {
        $connection = $this->getHeader('connection');

        if ($this->protocolVersion === '1.1') {
            return ($connection[0] === 'C' || $connection[0] === 'c');
        } else {
            return ($connection[0] !== 'K' && $connection[0] !== 'k');
        }
    }
660635
public function checkSocket($socket)
    {
        $read = [$socket];
        // loop through the sockets
        if (count($this->client) > 0) {
            for ($i = 0; $i < $this->max_clients; $i++) {
                if (isset($this->client[$i]) && $this->client[$i]['sock'] != null) {
                    $read[$i + 1] = $this->client[$i]['sock'];
                }
            }
        }

        return $read;
    }
906936
public function usesAttributesArray(): bool
    {
        if ($this->arrayName === null) {
            return false;
        }

        if ($this->attributes === null) {
            return false;
        }

        return true;
    }
529066
public function bindSocket()
    {
        if ($this->erroneous) {
            return false;
        }
        $port = $this->getPort();
        if (!is_int($port)) {
            Daemon::log(get_class($this) . ' (' . get_class($this->pool) . '): no port defined for \'' . $this->uri['uri'] . '\'');
            return;
        }
        if (($port < 1024) && Daemon::$config->user->value !== 'root') {
            $this->listenerMode = false;
        }
        if ($this->listenerMode) {
            $this->setFd($this->host . ':' . $port);
            return true;
        }
        $sock = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
        if (!$sock) {
            $errno = socket_last_error();
            Daemon::$process->log(get_class($this->pool) . ': Couldn\'t create TCP-socket (' . $errno . ' - ' . socket_strerror($errno) . ').');
            return false;
        }
        if ($this->reuse) {
            if (!socket_set_option($sock, SOL_SOCKET, SO_REUSEADDR, 1)) {
                $errno = socket_last_error();
                Daemon::$process->log(get_class($this->pool) . ': Couldn\'t set option REUSEADDR to socket (' . $errno . ' - ' . socket_strerror($errno) . ').');
                return false;
            }
            if (defined('SO_REUSEPORT') && !@socket_set_option($sock, SOL_SOCKET, SO_REUSEPORT, 1)) {
                $errno = socket_last_error();
                Daemon::$process->log(get_class($this->pool) . ': Couldn\'t set option REUSEPORT to socket (' . $errno . ' - ' . socket_strerror($errno) . ').');
                return false;
            }
        }
        if (!@socket_bind($sock, $this->host, $port)) {
            $errno = socket_last_error();
            Daemon::$process->log(get_class($this->pool) . ': Couldn\'t bind TCP-socket \'' . $this->host . ':' . $port . '\' (' . $errno . ' - ' . socket_strerror($errno) . ').');
            return false;
        }
        socket_getsockname($sock, $this->host, $this->port);
        socket_set_nonblock($sock);
        if (!$this->listenerMode) {
            if (!socket_listen($sock, SOMAXCONN)) {
                $errno = socket_last_error();
                Daemon::$process->log(get_class($this->pool) . ': Couldn\'t listen TCP-socket \'' . $this->host . ':' . $port . '\' (' . $errno . ' - ' . socket_strerror($errno) . ')');
                return false;
            }
        }
        $this->setFd($sock);
        return true;
    }
673310
public function isRequestSecured()
    {
        $remoteAddress = $this->server()->remoteAddress();

        $protocol = $this->server()->serverProtocol();
        $fwdProto = $this->server()->get($this->getTrustedHeaders()['client_proto']);
        if ($fwdProto && $fwdProto != '' && in_array($remoteAddress, $this->getTrustedProxies())) {
            $protocol = $fwdProto;
        }
        $protocol = strtolower($protocol);

        $isSecured = in_array($protocol, [
                'https',
                'on',
                '1'
            ]);

        if (!$isSecured) {
            if (in_array(strtolower($this->server()->https()), [
                    'https',
                    'on',
                    '1'
                ])) {
                $isSecured = true;
            }
        }

        return $isSecured;
    }
1233816
public function isSslConnection()
	{
		$serverSSLVar = $this->input->server->getString('HTTPS', '');

		if (!empty($serverSSLVar) && strtolower($serverSSLVar) !== 'off')
		{
			return true;
		}

		$serverForwarderProtoVar = $this->input->server->getString('HTTP_X_FORWARDED_PROTO', '');

		return !empty($serverForwarderProtoVar) && strtolower($serverForwarderProtoVar) === 'https';
	}
595715
public function useAssociatedPort() : bool
   {

      if ( null === $this->port )
      {
         return true;
      }

      switch ( $this->scheme )
      {

         case UrlScheme::HTTP:
            return ( $this->port === 80 );

         case UrlScheme::SSL:
            return ( $this->port === 443 );

         case UrlScheme::FTP:
            return ( $this->port === 21 );

         default :
            return false;

      }

   }