Search code examples
python-3.xtcpstreampython-asyncio

Is python3's BufferedProtocol an abstraction over TCP? Or is it so low-level that I have to implement the TCP things too?


I am referring to this: https://docs.python.org/3/library/asyncio-protocol.html#asyncio.BufferedProtocol

I haven't seen the answer to this question documented anywhere and I want to know the answer in advance of writing any code.

It seems to imply that it is a modification of asyncio.Protocol (for TCP) but seeing as though TCP is not mentioned for BufferedProtocol it's got me concerned that I'd have to contend with out of order packets etc.

Many thanks!


Solution

  • I can confirm - BufferedProtocol is for TCP only. Not for files or anything else. And it gives you a handle on a zero copy buffer to work with. That's basically all I wanted to know.