[Python-de] socket.create_connection() ipv4 oder ipv6?

Ulli Horlacher framstag at rus.uni-stuttgart.de
Di Jun 25 06:11:14 EDT 2019


Mit

  sock = socket.create_connection(('flupp.belwue.de',591))

bekomme ich einen tcp Link. Das funktioniert.

In der Doku steht dazu:

https://docs.python.org/3/library/socket.html

  Connect to a TCP service listening on the Internet address (a 2-tuple
  (host, port)), and return the socket object. This is a higher-level
  function than socket.connect(): if host is a non-numeric hostname, it
  will try to resolve it for both AF_INET and AF_INET6, and then try to
  connect to all possible addresses in turn until a connection succeeds.


flupp.belwue.de hat sowohl ipv4 als auch ipv6 Adresse. 
Welche wird genommen und warum?



-- 
Ullrich Horlacher              Server und Virtualisierung
Rechenzentrum TIK         
Universitaet Stuttgart         E-Mail: horlacher at tik.uni-stuttgart.de
Allmandring 30a                Tel:    ++49-711-68565868
70569 Stuttgart (Germany)      WWW:    http://www.tik.uni-stuttgart.de/


Mehr Informationen über die Mailingliste python-de