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/075516.html below:

[Python-Dev] blocking a non-blocking socket

[Python-Dev] blocking a non-blocking socket [Python-Dev] blocking a non-blocking socketOleg Broytmann phd at phd.pp.ru
Sun Dec 2 21:31:44 CET 2007
On Sun, Dec 02, 2007 at 12:23:01PM -0800, Bill Janssen wrote:
[skip]
> Or, should I just set the timeout:
> 
>     timeout = self.gettimeout()
>     try:
>         self.settimeout(None)
> 	self.do_handshake()
>     finally:
>         self.settimeout(timeout)

   Yes, this is the correct solution for all cases: if the timeout is None
(socket is blocking) or 0 (non-blocking) or not-0 (blocking with timeout)
- just set it back.

Oleg.
-- 
     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.
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