I am running an asyncio TCP server using the asyncio.Protocol class. When I am using the data variable in the data_received() function, I am getting all data that has ever been sent over the socket. Is there a way to flush the buffer every time I read from it? Here is my code:
def data_received(self, data):
data = str(data)
print("Received Data: ", data)
The only flush function I can find in the docs only works for the StreamWriter class which I am not using.