Example #1
0
 /**
  * @coroutine
  *
  * Returns a coroutine fulfilled when there is data available to read in the internal stream buffer. Note that
  * this method does not consider data that may be available in the internal buffer. This method should be used to
  * implement functionality that uses the stream socket resource directly.
  *
  * @param float|int $timeout Number of seconds until the returned promise is rejected with a TimeoutException
  *     if no data is received. Use null for no timeout.
  *
  * @return \Generator
  *
  * @resolve string Empty string.
  *
  * @throws \Icicle\Awaitable\Exception\TimeoutException If the operation times out.
  * @throws \Icicle\Stream\Exception\FailureException If the stream buffer is not empty.
  * @throws \Icicle\Stream\Exception\UnreadableException If the stream is no longer readable.
  * @throws \Icicle\Stream\Exception\ClosedException If the stream has been closed.
  */
 public function poll(float $timeout = 0) : \Generator
 {
     return $this->readable->poll($timeout);
 }