summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2003-04-25 05:48:32 (GMT)
committerGuido van Rossum <guido@python.org>2003-04-25 05:48:32 (GMT)
commit47dfa4a89ad1ce110a8218e43cae228302019297 (patch)
tree1bd9ec116ee42905854d5cb59fdacc00a432e322 /Doc
parent45f41300298ca522fba9366989317f34a2d7e2db (diff)
downloadcpython-47dfa4a89ad1ce110a8218e43cae228302019297.zip
cpython-47dfa4a89ad1ce110a8218e43cae228302019297.tar.gz
cpython-47dfa4a89ad1ce110a8218e43cae228302019297.tar.bz2
Patch by Jp Calderone:
- The socket module now provides the functions inet_pton and inet_ntop for converting between string and packed representation of IP addresses. See SF patch #658327. This still needs a bit of work in the doc area, because it is not available on all platforms (especially not on Windows).
Diffstat (limited to 'Doc')
-rw-r--r--Doc/lib/libsocket.tex42
1 files changed, 42 insertions, 0 deletions
diff --git a/Doc/lib/libsocket.tex b/Doc/lib/libsocket.tex
index 4febf22..73c0ff3 100644
--- a/Doc/lib/libsocket.tex
+++ b/Doc/lib/libsocket.tex
@@ -150,6 +150,11 @@ those symbols that are defined in the \UNIX{} header files are defined;
for a few symbols, default values are provided.
\end{datadesc}
+\begin{datadesc}{has_ipv6}
+This constant contains a boolean value which indicates if IPv6 is
+supported on this platform.
+\end{datadesc}
+
\begin{funcdesc}{getaddrinfo}{host, port\optional{, family, socktype, proto, flags}}
Resolves the \var{host}/\var{port} argument, into a sequence of
@@ -349,6 +354,43 @@ length, \exception{socket.error} will be raised.
support.
\end{funcdesc}
+\begin{funcdesc}{inet_pton}{address_family, ip_string}
+Convert an IP address from its family-specific string format to a packed,
+binary format.
+
+Supported values for address_family are currently \constant{AF_INET}
+and \constant{AF_INET6}.
+
+\function{inet_pton()} is useful when a library or network protocol calls for
+an object of type \ctype{struct in_addr} (similar to \function{inet_aton()})
+or \ctype{struct in6_addr}.
+
+If the IP address string passed to this function is invalid,
+\exception{socket.error} will be raised. Note that exactly what is valid
+depends on both the value of \var{address_family} and the underlying
+implementation of \cfunction{inet_pton()}.
+\versionadded{2.3}
+\end{funcdesc}
+
+\begin{funcdesc}{inet_ntop}{address_family, packed_ip}
+Convert a packed IP address (a string of some number of characters) to its
+standard, family-specific string representation (for example, '7.10.0.5' or
+'5aef:2b::8')
+
+Supported values for address_family are currently \constant{AF_INET}
+and \constant{AF_INET6}.
+
+\function{inet_pton()} is useful when a library or network protocol calls for
+an object of type \ctype{struct in_addr} (similar to \function{inet_aton()})
+or \ctype{struct in6_addr}.
+
+If the string passed to this function is not the correct length for the
+specified address family, \exception{ValueError} will be raised.
+A \exception{socket.error} is raised for errors from the call to
+\function{inet_ntop()}.
+\versionadded{2.3}
+\end{funcdesc}
+
\begin{funcdesc}{getdefaulttimeout}{}
Return the default timeout in floating seconds for new socket objects.
A value of \code{None} indicates that new socket objects have no timeout.