STINNER Victor added the comment: Paulo Costa: > async def async_read(fd. n):
This method already exists: * (TCP) https://docs.python.org/dev/library/asyncio-protocol.html#asyncio.Protocol.data_received * (UDP) https://docs.python.org/dev/library/asyncio-protocol.html#asyncio.DatagramProtocol.datagram_received * (TCP) https://docs.python.org/dev/library/asyncio-stream.html#asyncio.StreamReader.read Martin Panter: > last time I looked they all seemed to buffer your write data and send it in > the background. E.g. in the echo-client-using-streams example, there is a > writer.write() call that does not use “yield from”. Does asyncio have an easy > way for a coroutine to write to a socket (or file descriptor) and block > (suspend the coroutine) until the write has finished Sure, you must call https://docs.python.org/dev/library/asyncio-stream.html#asyncio.StreamWriter.drain ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26270> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com