Skip to content

Support half-open duplex streams #27

Description

@clue

React PHP has support for both bidirectional duplex streams and unidirectional half-duplex streams.

  • A unidirectional readable stream should close once it can no longer be read.
  • A unidirectional writable stream should close once it can no longer be written to.
  • A bidirectional duplex stream currently closes once if can either no longer be read or no longer be written to.

We should add an option to allow bidirectional duplex streams to be half-open. In this mode the readable and writable state would be checked independently.

This is particularly useful for some TCP/IP-based protocols where the client sends a FIN message to the server indicating that it will no longer write any data but is still willing to accept incoming data.

Activity

  1. clue commented on Sep 16, 2015

    @clue
    MemberAuthor

    For the reference, Node.js also has a allowHalfOpen flag which happens to default to true.
    It's net module also offers the same options which appears to default to false.

  2. nick4fake commented on Mar 15, 2017

    @nick4fake

    Just trapped into a nasty bug with old PHP version (PHP 5.5.10)

    If we have write-only stream (new Stream(fopen($file, 'wb), $loop)) then stream_get_contents blocks execution even in non-blocking mode.

  3. clue commented on Mar 16, 2017

    @clue
    MemberAuthor

    @nick4fake This sounds like a separate issue (which could possibly be related to #46). Can you file a separate ticket and provide some details / a gist so I can look into this? Thanks!

  4. changed the title [-]Support half-open streams[/-] [+]Support half-open duplex streams[/+] on May 4, 2017
  5. added this to the v1.1.0 milestone on Oct 10, 2017
  6. removed this from the v1.1.0 milestone on Oct 19, 2018
  7. clue commented on Apr 23, 2021

    @clue
    MemberAuthor

    I still think that this feature makes perfect sense 👍 However, there are currently no immediate plans to build this from my end (no demand at the moment and more important outstanding issues currently), but I suppose we would be really happy to accept PRs 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions