stream_set_blocking

Supported Versions: PHP 4 >= 4.3.0, PHP 5, PHP 7, PHP 8
Set blocking/non-blocking mode on a stream
<?php stream_set_blocking(resource $stream, bool $enable): bool
<?php         @\stream_socket_shutdown($this->stream, \STREAM_SHUT_RDWR);

        \stream_set_blocking($this->stream, false);

    }



    public function getRemoteAddress()
<?php         $this->unix = \parse_url($this->getAddress(), \PHP_URL_PORT) === false;



        \stream_set_blocking($this->master, false);



        $this->resume();

    }
<?php                 $errno

            );

        }

        \stream_set_blocking($this->master, false);



        $this->resume();

    }
<?php                 $errno

            );

        }

        \stream_set_blocking($this->master, 0);



        $this->resume();

    }
<?php require __DIR__ . '/../vendor/autoload.php';



if (!defined('STDIN') || stream_set_blocking(STDIN, false) !== true) {

    fwrite(STDERR, 'ERROR: Unable to set STDIN non-blocking (not CLI or Windows?)' . PHP_EOL);

    exit(1);

}
<?php     if ($chunk === '') {

        Loop::removeReadStream($stream);

        stream_set_blocking($stream, true);

        fclose($stream);

        return;

    }
<?php $data = str_repeat($data, round(200000 / strlen($data)));



if (!defined('STDOUT') || stream_set_blocking(STDOUT, false) !== true) {

    fwrite(STDERR, 'ERROR: Unable to set STDOUT non-blocking (not CLI or Windows?)' . PHP_EOL);

    exit(1);

}
<?php     if ($r === 0) {

        Loop::removeWriteStream($stdout);

        fclose($stdout);

        stream_set_blocking($stdout, true);

        fwrite(STDERR, 'Stopped because STDOUT closed' . PHP_EOL);



        return;
<?php if (!$stream) {

    exit(1);

}

stream_set_blocking($stream, false);




fwrite($stream, "GET / HTTP/1.1\r\nHost: www.google.com\r\nConnection: close\r\n\r\n");
<?php if (!$stream) {

    exit(1);

}

stream_set_blocking($stream, false);




echo 'Connecting';
<?php if (!$server) {

    exit(1);

}

stream_set_blocking($server, false);




Loop::addReadStream($server, function ($server) {
<?php     public function testRemoveReadAndWriteStreamFromLoopOnceResourceClosesEndsLoop()

    {

        list($stream, $other) = $this->createSocketPair();

        stream_set_blocking($stream, false);

        stream_set_blocking($other, false);
<?php     {

        list($stream, $other) = $this->createSocketPair();

        stream_set_blocking($stream, false);

        stream_set_blocking($other, false);




        $this->loop->addWriteStream($stream, function () { });
<?php     public function testRemoveReadAndWriteStreamFromLoopOnceResourceClosesOnEndOfFileEndsLoop()

    {

        list($stream, $other) = $this->createSocketPair();

        stream_set_blocking($stream, false);

        stream_set_blocking($other, false);
<?php     {

        list($stream, $other) = $this->createSocketPair();

        stream_set_blocking($stream, false);

        stream_set_blocking($other, false);




        $this->loop->addWriteStream($stream, function () { });