Skip to content

Support half-open duplex streams #27

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
clue opened this issue Sep 16, 2015 · 4 comments
Closed

Support half-open duplex streams #27

clue opened this issue Sep 16, 2015 · 4 comments

Comments

@clue
Copy link
Member

clue commented Sep 16, 2015

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.

@clue
Copy link
Member Author

clue commented Sep 16, 2015

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.

@nick4fake
Copy link

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.

@clue
Copy link
Member Author

clue commented Mar 16, 2017

@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!

@clue clue changed the title Support half-open streams Support half-open duplex streams May 4, 2017
@clue clue added this to the v1.1.0 milestone Oct 10, 2017
@clue clue removed this from the v1.1.0 milestone Oct 19, 2018
@clue
Copy link
Member Author

clue commented Apr 23, 2021

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 👍

@clue clue closed this as completed Apr 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants