Skip to content

asyncio.StreamReader.read does what exactly? #100226

@ygoe

Description

@ygoe

Documentation

https://docs.python.org/3/library/asyncio-stream.html#asyncio.StreamReader.read

It remains unclear what exactly that method does. It will give me no more than n bytes from the stream. That's a pretty vague contract. Will it sit there until so many bytes are available? Or will it return each one separately? Will they be fragmented in some way? How long will it wait for more bytes to become available?

And what does "EOF" mean?! I know this from the old DOS days as "end of file" but it has two meanings (the byte \x1A inside a file, or the actual end of a file on disk) which I don't see apply here.

Similarly for the other read methods, will they wait and only return when so many bytes have been received? Are there any timeouts? What about cancellation? I'm not sure if I can expect the same level of features as in .NET, but at least I'd like to know what to expect.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions