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/2007-December/075525.html below:

[Python-Dev] blocking a non-blocking socket

[Python-Dev] blocking a non-blocking socket [Python-Dev] blocking a non-blocking socketGreg Ewing greg.ewing at canterbury.ac.nz
Mon Dec 3 01:10:44 CET 2007
Bill Janssen wrote:
> What I'd like to do is just use the socket API,
> something like:
> 
>     blocking = self.getblocking()
>     try:
>         self.setblocking(1)
> 	self.do_handshake()
>     finally:
>         self.setblocking(blocking)

I'm not sure this is the right  approach. If the calling code
has made the socket non-blocking, then it doesn't want any
operations on it to block. Rather than temporarily
making it blocking by whatever means, some indication needs
to be returned that the operation would block, and a way
provided for the calling code to re-try later.

If that can't reasonably be done, then passing a non-blocking
socket here should be an error.

> But my mother taught me never to test for equality against
> floating-point zero.

That doesn't apply here. If a float is explicitly set to 0.0
you can reasonably expect it to test equal to 0.0. The caveat
only applies to results of a calculation, which may incorporate
roundoff errors.

--
Greg
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