[docs] socket docs inconsistency (python 2.7.1 over linux)
educastellano08 at gmail.com
Thu Sep 15 15:42:45 CEST 2011
In the documentation of sockets:
*Set blocking or non-blocking mode of the socket: if flag is 0, the socket
is set to non-blocking, else to blocking mode. Initially all sockets are in
blocking mode. In non-blocking mode, if a recv() call doesn’t find any data,
or if a send() call can’t immediately dispose of the data, a error exception
is raised; in blocking mode, the calls block until they can proceed.
s.setblocking(0) is equivalent to s.settimeout(0.0); s.setblocking(1) is
equivalent to s.settimeout(None).*
*Set a timeout on blocking socket operations. The value argument can be a
nonnegative float expressing seconds, or None. If a float is given,
subsequent socket operations will raise a timeout exception if the timeout
period value has elapsed before the operation has completed. Setting a
timeout of None disables timeouts on socket operations. s.settimeout(0.0) is
equivalent to s.setblocking(0); s.settimeout(None) is equivalent to
When I'm trying this, I get an "error exception" in both functions. Should
it be "timeout exception" for settimeout().
I suggest also to raise another type of exception in setblocking(), "empty
buffer"? or something like that.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs