Re: [python-tulip] sockets, eof_received() and shutdown()

2014-06-27 Thread Glyph
"Didn't receive any data" is the wrong way of looking at this. It closes the socket if it receives an EOF. A 0-byte return is an authoritative statement that there *will be* no more data, not that there isn't any right now. "there isn't any right now" is EAGAIN. A couple of brief experiments

Re: [python-tulip] sockets, eof_received() and shutdown()

2014-06-27 Thread Guido van Rossum
What effect would calling shutdown(SHUT_RD) at this point have? The kernel already knows that no more data will be read. IIUC SHUT_RD would be useful only if you want to indicate you are not interested in reading more without having received an EOF. On Fri, Jun 27, 2014 at 2:26 PM, Victor Stinner

[python-tulip] sockets, eof_received() and shutdown()

2014-06-27 Thread Victor Stinner
Hi, While reviewing an old asyncore issue, http://bugs.python.org/issue12498 I read the source code of _SelectorSocketTransport. I see that write_eof() calls sock.shutdown(socket.SHUT_WR). _read_ready() closes the socket if it didn't receive any data. It can keep the socket open to write more da