<div dir="ltr"><div><div><div><div><div><div>>> Marko Rauhamaa:<br>>>> socket.shutdown(socket.SHUT_WR) does the trick.<br>>>><br>>>> I think the asyncio.StreamWriter.write_eof() is the high-level<br>>>> equivalent.<br>>><br>>> You are right that writer.write_eof() behaves like<br>>> writer.transport.get_extra_info("socket").shutdown(socket.SHUT_WR) –<br>>> the server resumes and sends the response. However, the client still<br>>> reads empty bytes afterwards.<br>> <br>> Reading empty bytes means the peer has shut down its end of the<br>> connection.<br><br></div>But it didn't or had sent a response before. My code suppose to be like this:<br></div>1) The client sends a request message.<br></div>2) The client closes the writing direction of the socket.<br></div>3) The server reads the request message.<br></div>4) The server sends a response message and possibly closes the other direction of the socket.<br></div>5) The client reads data – it should read the response sent by the server but gets empty bytes instead.<br><br></div>