[Python-checkins] python/dist/src/Doc/lib libsocket.tex,1.69,1.70

gvanrossum@users.sourceforge.net gvanrossum@users.sourceforge.net
Thu, 24 Apr 2003 22:48:34 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory sc8-pr-cvs1:/tmp/cvs-serv26816/Doc/lib

Modified Files:
	libsocket.tex 
Log Message:
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).


Index: libsocket.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libsocket.tex,v
retrieving revision 1.69
retrieving revision 1.70
diff -C2 -d -r1.69 -r1.70
*** libsocket.tex	20 Mar 2003 17:58:12 -0000	1.69
--- libsocket.tex	25 Apr 2003 05:48:31 -0000	1.70
***************
*** 151,154 ****
--- 151,159 ----
  \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}}
  
***************
*** 348,351 ****
--- 353,393 ----
  \function{getnameinfo()} should be used instead for IPv4/v6 dual stack
  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}