I have a simple server that uses asyncio StreamWriter to continually send
data to a client.  The problem I have is that, if a client disconnects my
code is unaware and continues to send data.  asyncio just prints a useless
"write:socket.send() raised exception" warning.

Given a StreamWriter, how to handle disconnections?  I've been searching,
and could find no way:

1. There is no is_closed() method in StreamWriter

2. There is a StreamWriter.transport property, but also there is no
is_closed() method in the Transport;

IMHO, if a transport is closed StreamWriter.write() should simply raise a
well known exception.  Thoughts?

-- 
Gustavo J. A. M. Carneiro
Gambit Research
"The universe is always one step beyond logic." -- Frank Herbert

Reply via email to