>> 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.
But it didn't or had sent a response before. My code suppose to be like this: 1) The client sends a request message. 2) The client closes the writing direction of the socket. 3) The server reads the request message. 4) The server sends a response message and possibly closes the other direction of the socket. 5) The client reads data – it should read the response sent by the server but gets empty bytes instead.
-- https://mail.python.org/mailman/listinfo/python-list