Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1b79e2d

Browse files
committed
Issue #24357: Change host in socket.getaddrinfo example to one that
does support IPv6 and IPv4; www.python.org currently does not.
1 parent 70adad2 commit 1b79e2d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

Doc/library/socket.rst

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -461,12 +461,14 @@ The :mod:`socket` module also offers various network-related services:
461461
method.
462462

463463
The following example fetches address information for a hypothetical TCP
464-
connection to ``www.python.org`` on port 80 (results may differ on your
464+
connection to ``google.com` on port 80 (results may differ on your
465465
system if IPv6 isn't enabled)::
466466
467-
>>> socket.getaddrinfo("www.python.org", 80, proto=socket.IPPROTO_TCP)
468-
[(2, 1, 6, '', ('82.94.164.162', 80)),
469-
(10, 1, 6, '', ('2001:888:2000:d::a2', 80, 0, 0))]
467+
>>> socket.getaddrinfo("google.com", 80, proto=socket.IPPROTO_TCP)
468+
[(<AddressFamily.AF_INET6: 10>, <SocketType.SOCK_STREAM: 1>,
469+
6, '', ('2607:f8b0:4005:803::200e', 80, 0, 0)),
470+
(<AddressFamily.AF_INET: 2>, <SocketType.SOCK_STREAM: 1>,
471+
6, '', ('216.58.192.46', 80))]
470472
471473
.. versionchanged:: 3.2
472474
parameters can now be passed using keyword arguments.

0 commit comments

Comments
 (0)