summaryrefslogtreecommitdiffstats
path: root/Doc/lib/libsocket.tex
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2002-06-06 21:51:01 (GMT)
committerGuido van Rossum <guido@python.org>2002-06-06 21:51:01 (GMT)
commitbe946bfea7acfeeb0a8bbb01faca117230df17d5 (patch)
tree51e5fa1e117ba8af5fb79ad2e3e5d69e834b8cce /Doc/lib/libsocket.tex
parent15699055e9cb0929fa749aa7e3e3b5ec084121c6 (diff)
downloadcpython-be946bfea7acfeeb0a8bbb01faca117230df17d5.zip
cpython-be946bfea7acfeeb0a8bbb01faca117230df17d5.tar.gz
cpython-be946bfea7acfeeb0a8bbb01faca117230df17d5.tar.bz2
SF patch 555085 (timeout socket implementation) by Michael Gilfix.
I've made considerable changes to Michael's code, specifically to use the select() system call directly and to store the timeout as a C double instead of a Python object; internally, -1.0 (or anything negative) represents the None from the API. I'm not 100% sure that all corner cases are covered correctly, so please keep an eye on this. Next I'm going to try it Windows before Tim complains. No way is this a bugfix candidate. :-)
Diffstat (limited to 'Doc/lib/libsocket.tex')
-rw-r--r--Doc/lib/libsocket.tex23
1 files changed, 23 insertions, 0 deletions
diff --git a/Doc/lib/libsocket.tex b/Doc/lib/libsocket.tex
index 97c5184..0fe8940 100644
--- a/Doc/lib/libsocket.tex
+++ b/Doc/lib/libsocket.tex
@@ -514,6 +514,29 @@ all sockets are in blocking mode. In non-blocking mode, if a
block until they can proceed.
\end{methoddesc}
+\begin{methoddesc}[socket]{settimeout}{value}
+Set a timeout on blocking socket operations. Value can be any numeric value
+or \var{None}. Socket operations will raise an \exception{error} exception
+if the timeout period \var{value} has elapsed before the operation has
+completed. Setting a timeout of \var{None} disables timeouts on socket
+operations.
+\end{methoddesc}
+
+\begin{methoddesc}[socket]{gettimeout}{}
+Returns the timeout in floating seconds associated with socket operations.
+A timeout of None indicates that timeouts on socket operations are
+disabled.
+\end{methoddesc}
+
+Some notes on the interaction between socket blocking and timeouts:
+socket blocking mode takes precendence over timeouts. If a socket
+if set to non-blocking mode, then timeouts set on sockets are never
+don't mean anything. The timeout value associated with the socket
+can still be set via settimeout and its value retrieved via gettimeout,
+but the timeout is never enforced (i.e, an exception will never be
+thrown). Otherwise, if the socket is in blocking mode, setting the
+timeout will raise an exception as expected.
+
\begin{methoddesc}[socket]{setsockopt}{level, optname, value}
Set the value of the given socket option (see the \UNIX{} manual page
\manpage{setsockopt}{2}). The needed symbolic constants are defined in