diff options
author | Fred Drake <fdrake@acm.org> | 1999-09-16 15:50:00 (GMT) |
---|---|---|
committer | Fred Drake <fdrake@acm.org> | 1999-09-16 15:50:00 (GMT) |
commit | e6fb1c4bd3ca5c369cb33ad6228ec3eb1f13b23b (patch) | |
tree | f0a84e75c253def22e53777970f195aa77b2b61f | |
parent | 2174dcb06187098ceecad4e932ddfc95ffc36612 (diff) | |
download | cpython-e6fb1c4bd3ca5c369cb33ad6228ec3eb1f13b23b.zip cpython-e6fb1c4bd3ca5c369cb33ad6228ec3eb1f13b23b.tar.gz cpython-e6fb1c4bd3ca5c369cb33ad6228ec3eb1f13b23b.tar.bz2 |
Added documentation for inet_aton() and inet_ntoa(), from Ben
Gertzfield <che@debian.org> (with minor changes).
(Should have been here instead of in the branch in the first place,
since these weren't in for the 1.5.2 release.)
-rw-r--r-- | Doc/lib/libsocket.tex | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Doc/lib/libsocket.tex b/Doc/lib/libsocket.tex index 2639f4e..e8c8731 100644 --- a/Doc/lib/libsocket.tex +++ b/Doc/lib/libsocket.tex @@ -194,6 +194,34 @@ where the host byte order is the same as network byte order, this is a no-op; otherwise, it performs a 2-byte swap operation. \end{funcdesc} +\begin{funcdesc}{inet_aton}{ip_string} +Convert an IP address from dotted-quad string format +(e.g.\ '123.45.67.89') to 32-bit packed binary format, as a string four +characters in length. + +Useful when conversing with a program that uses the standard C library +and needs objects of type \ctype{struct in_addr}, which is the C type +for the 32-bit packed binary this function returns. + +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 the underlying C implementation of +\cfunction{inet_aton()}. +\end{funcdesc} + +\begin{funcdesc}{inet_ntoa}{packed_ip} +Convert a 32-bit packed IP address (a string four characters in +length) to its standard dotted-quad string representation +(e.g. '123.45.67.89'). + +Useful when conversing with a program that uses the standard C library +and needs objects of type \ctype{struct in_addr}, which is the C type +for the 32-bit packed binary this function takes as an argument. + +If the string passed to this function is not exactly 4 bytes in +length, \exception{socket.error} will be raised. +\end{funcdesc} + \begin{datadesc}{SocketType} This is a Python type object that represents the socket object type. It is the same as \code{type(socket(...))}. |