A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2008-May/079218.html below:

[Python-Dev] sock.close() not closing?

[Python-Dev] sock.close() not closing? [Python-Dev] sock.close() not closing?Robert Brewer fumanchu at aminus.org
Wed May 7 18:07:08 CEST 2008
Sjoerd Mullender wrote:
> On 2008-05-07 13:37, Amaury Forgeot d'Arc wrote:
> > 2008/5/7 Sjoerd Mullender <sjoerd at acm.org>:
> >> I would expect that a system call is done to actually close the
> >> socket and free the file descriptor.  But that does not happen.
> >
> > It does close the socket:
> >
> > In socket.py, when self._sock is replaced, its __del__ method will
be
> > called.
> 
> I have to question the design of this.  When I close() an object I
> expect it to be closed there and then and not at some indeterminate
> later time (well, it is determinate when you're fully aware of all
> references, but often you aren't--trust me, I understand reference
> counting).

Even if you're fully aware of all references, it's indeterminate in
multithreaded apps. I've just taken to doing:

    self.socket._sock.close()
    self.socket.close()

...in order to send the FIN I wanted ASAP.


Robert Brewer
fumanchu at aminus.org

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4