Title: recv returning 0 on closed connection not documented
Type: enhancement Stage:
Components: Documentation Versions: Python 3.6
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, joders, taleinat, terry.reedy
Priority: normal Keywords:

Created on 2018-03-22 14:15 by joders, last changed 2018-07-25 18:11 by taleinat.

Messages (3)
msg314260 - (view) Author: (joders) Date: 2018-03-22 14:15
The "Linux Programmer's Manual" states:

When a stream socket peer has performed an orderly shutdown, the return value will be 0 (the traditional "end-of-file" return).

I find that information pretty important which is why I am asking if you might want to add it to the python documentation as well. It would have prevented a bug in my code.
msg314352 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2018-03-24 01:29
Please make a specific suggestion for a change in a specific location in the current online version of a particular doc -- the one you wish had been there already.
msg322380 - (view) Author: Tal Einat (taleinat) * (Python committer) Date: 2018-07-25 18:11
My guess would be the docs for socket.recv()[1], which indeed don't mention what the return value is after a socket has been closed, nor can I find that info elsewhere on that page.

Those docs for socket generally avoid going into detail, including specifically regarding returned values.  Apparently the approach is that this general note about the class explains where to look for more info:

"Socket objects have the following methods. Except for makefile(), these correspond to Unix system calls applicable to sockets."

Given this, I don't think adding this one small detail would be in line with the existing approach to documenting the socket class.

Date User Action Args
2018-07-25 18:11:20taleinatsetnosy: + taleinat
messages: + msg322380
2018-03-24 01:29:03terry.reedysetnosy: + terry.reedy
messages: + msg314352
2018-03-22 14:15:08joderscreate