Skip to content
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

ReadAll() Implementation for bidirectional stream #42

Closed
moksh-samespace opened this issue Oct 27, 2022 · 2 comments
Closed

ReadAll() Implementation for bidirectional stream #42

moksh-samespace opened this issue Oct 27, 2022 · 2 comments

Comments

@moksh-samespace
Copy link

Quic-go support ReadAll() for bidirectional stream. Is there any way to achieve this in webtransport-go?

@marten-seemann
Copy link
Member

That's standard library functionality.

@moksh-samespace
Copy link
Author

moksh-samespace commented Oct 27, 2022

Can you help with an example how I can achieve this

Current Implementation:
`
stream, err := conn.AcceptStream(conn.Context())
if err != nil {
fmt.Println("Session closed, not accepting more bidi streams:", err)
break
}

for {
buf := make([]byte, 1024)
n, err := stream.Read(buf)
if err != nil {
fmt.Printf("Error reading from bidi stream %v\n", err)
break
}
}
`

Required:
buf, err := stream.ReadAll()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants