asyncio.StreamWriter.write_eof()

write_eof() Close the write end of the transport after flushing buffered data: see WriteTransport.write_eof().

asyncio.StreamWriter.writelines()

writelines(data) Write a list (or any iterable) of data bytes to the transport: see WriteTransport.writelines().

asyncio.StreamWriter

class asyncio.StreamWriter(transport, protocol, reader, loop) Wraps a Transport. This exposes write(), writelines(), can_write_eof(), write_eof(), get_extra_info() and close(). It adds drain() which returns an optional Future on which you can wait for flow control. It also adds a transport attribute which references the Transport directly. This class is not thread safe. transport Transport. can_write_eof() Return True if the transport supports write_eof(), False if not. See WriteTra

asyncio.StreamReaderProtocol

class asyncio.StreamReaderProtocol(stream_reader, client_connected_cb=None, loop=None) Trivial helper class to adapt between Protocol and StreamReader. Subclass of Protocol. stream_reader is a StreamReader instance, client_connected_cb is an optional function called with (stream_reader, stream_writer) when a connection is made, loop is the event loop instance to use. (This is a helper class instead of making StreamReader itself a Protocol subclass, because the StreamReader has other potentia

asyncio.StreamWriter.can_write_eof()

can_write_eof() Return True if the transport supports write_eof(), False if not. See WriteTransport.can_write_eof().

asyncio.StreamWriter.close()

close() Close the transport: see BaseTransport.close().

asyncio.StreamReader.read()

coroutine read(n=-1) Read up to n bytes. If n is not provided, or set to -1, read until EOF and return all read bytes. If the EOF was received and the internal buffer is empty, return an empty bytes object. This method is a coroutine.

asyncio.StreamReader.set_exception()

set_exception(exc) Set the exception.

asyncio.StreamReader.readline()

coroutine readline() Read one line, where “line” is a sequence of bytes ending with \n. If EOF is received, and \n was not found, the method will return the partial read bytes. If the EOF was received and the internal buffer is empty, return an empty bytes object. This method is a coroutine.

asyncio.StreamReader.readexactly()

coroutine readexactly(n) Read exactly n bytes. Raise an IncompleteReadError if the end of the stream is reached before n can be read, the IncompleteReadError.partial attribute of the exception contains the partial read bytes. This method is a coroutine.