[docs] [issue31739] socket.close recommended but not demonstrated in same-page example code

Nathaniel Manista report at bugs.python.org
Tue Oct 17 15:03:04 EDT 2017

Nathaniel Manista <nathaniel at google.com> added the comment:

As I am learning from the examples, I don't have the confidence to propose a fix to them. :-P

For the IPv4-and-IPv6 "Echo server program": should s be closed at some point after "conn, addr = s.accept()"? Should s be closed on the line immediately after "conn, addr = s.accept()", should it be closed on the last line (after the "with conn:" context is exited), or is either acceptable?

Should the "very simple network sniffer with raw sockets on Windows" have a with statement or "s.close()"? Should the "communicate to a CAN network using the raw socket protocol" example have a with statement or "s.close()"?

Of course it's possible that I'm misunderstanding one or more things.


Python tracker <report at bugs.python.org>

More information about the docs mailing list