Yury Selivanov <yseliva...@gmail.com> added the comment:

It looks like we have a bug with 'sock.settimeout()' and non-blocking/blocking 
modes (or maybe this is a feature?)

Currently:

* to make a socket non-blocking, we call 'sock.settimeout(0)'.

* to make a socket blocking, we call 'sock.settimeout(None)'.


What happens if we call sock.settimeout(t), where t > 0?  The internal timeout 
field of the socket object will simply be set to 't'.  What happens if the 
socket was in a non-blocking mode?  Nothing, it stays in non-blocking mode.

What it means: suppose you have a non-blocking socket.  You call 
socket.settimeout(10), and most likely you wanted to make it blocking again.  
Because all operations on the socket become blocking from moment (sock_call_ex 
repeats on EWOULDBLOCK and EAGAIN).

Now is having a timeout and blocking send/recv methods on a non-blocking socket 
a feature? Or is this a bug?

----------
nosy: +njs, pitrou

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32373>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to