An asyncio example

Marko Rauhamaa marko at pacujo.net
Fri Jul 3 16:01:29 EDT 2015


Adam Bartoš <drekin at gmail.com>:

> Marko Rauhamaa:
>> socket.shutdown(socket.SHUT_WR) does the trick.
>>
>> I think the asyncio.StreamWriter.write_eof() is the high-level
>> equivalent.
>
> You are right that writer.write_eof() behaves like
> writer.transport.get_extra_info("socket").shutdown(socket.SHUT_WR) –
> the server resumes and sends the response. However, the client still
> reads empty bytes afterwards.

Reading empty bytes means the peer has shut down its end of the
connection.


Marko



More information about the Python-list mailing list