Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > de.comp.lang.python > #5516
| Path | csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail |
|---|---|
| From | Julian Gethmann <mail.python.org@gethmann.org> |
| Newsgroups | de.comp.lang.python |
| Subject | Re: [Python-de] socket.create_connection() ipv4 oder ipv6? |
| Date | Tue, 25 Jun 2019 15:42:00 +0200 |
| Lines | 59 |
| Message-ID | <mailman.21.1561470135.29664.python-de@python.org> (permalink) |
| References | <qess02$t26$1@news2.informatik.uni-stuttgart.de> <gnebcoFcaktU1@mid.individual.net> <qet6ra$vtp$1@news2.informatik.uni-stuttgart.de> <f6e249a1-8afd-335f-53b9-bd4b63a7fe04@gethmann.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=utf-8; format=flowed |
| Content-Transfer-Encoding | 8bit |
| X-Trace | news.uni-berlin.de H2PYEJjB5KF+6pD3KuZY+gIQCC0UCQbDynt3R9zcFsAw== |
| Return-Path | <mail.python.org@gethmann.org> |
| X-Original-To | python-de@python.org |
| Delivered-To | python-de@mail.python.org |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.7.0 |
| In-Reply-To | <qet6ra$vtp$1@news2.informatik.uni-stuttgart.de> |
| Content-Language | en-US |
| X-BeenThere | python-de@python.org |
| X-Mailman-Version | 2.1.29 |
| Precedence | list |
| List-Id | Die Deutsche Python Mailingliste <python-de.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-de>, <mailto:python-de-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-de/> |
| List-Post | <mailto:python-de@python.org> |
| List-Help | <mailto:python-de-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-de>, <mailto:python-de-request@python.org?subject=subscribe> |
| X-Mailman-Original-Message-ID | <f6e249a1-8afd-335f-53b9-bd4b63a7fe04@gethmann.org> |
| X-Mailman-Original-References | <qess02$t26$1@news2.informatik.uni-stuttgart.de> <gnebcoFcaktU1@mid.individual.net> <qet6ra$vtp$1@news2.informatik.uni-stuttgart.de> |
| Xref | csiph.com de.comp.lang.python:5516 |
Show key headers only | View raw
Hi,
bei mir liefert
>>> sock.family
<AddressFamily.AF_INET6: 10>
zurück. Ein Blick in die Python-Quellen zeigt, dass getaddrinfo benutzt
wird, welches auch sowohl v6, als auch v4 zurück liefert.
Ich denke, dass die Betriebssystem-Funktionen genutzt werden, sprich auf
aktuellen Linux, Mac und Windows v6 priorisiert wird (afaik).
Hoffentlich hilft das schon mal ein bisschen weiter. Nach
"socket.getaddrinfo??" kommt dann C-code ;)
Mit freundlichen Grüßen,
Julian Gethmann
On 25/06/2019 15.16, Ulli Horlacher wrote:
> Peter Heitzer <peter.heitzer@rz.uni-regensburg.de> wrote:
>
>>> 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?
>>
>> In der Doku steht auch:
>> To use create_connection() to connect to a IPv6 address the server socket also should have been created using the address family AF_INET6.
>> Ich verstehe das so, daß du wenn du den Socket mit AF_INET erzeugt hast,
>> nur eine V4 Auflösung gemacht wird und bei Erzeugen mit AF_INET6 nur
>> eine V6 Auflösung. Der Socket kann ja nur entweder V4 oder V6 sein.
>> Der Default für socket.socket ist AF_INET, also wird wohl eine V4 Adresse
>> genommen.
>
> Ich hab nichts (mehr) gemacht als:
>
> sock = socket.create_connection(('flupp.belwue.de',591))
>
> Ich hab also weder AF_INET noch AF_INET6 angegeben.
>
> Genau DAS ist ja meine Frage: was passiert, wenn ich nichts angebe?
>
>
Back to de.comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar
socket.create_connection() ipv4 oder ipv6? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2019-06-25 10:11 +0000
Re: socket.create_connection() ipv4 oder ipv6? "Peter Heitzer" <peter.heitzer@rz.uni-regensburg.de> - 2019-06-25 10:29 +0000
Re: socket.create_connection() ipv4 oder ipv6? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2019-06-25 13:16 +0000
Re: [Python-de] socket.create_connection() ipv4 oder ipv6? Julian Gethmann <mail.python.org@gethmann.org> - 2019-06-25 15:42 +0200
Re: [Python-de] socket.create_connection() ipv4 oder ipv6? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2019-06-25 15:46 +0000
Re: socket.create_connection() ipv4 oder ipv6? Florian Weimer <fw@deneb.enyo.de> - 2019-06-29 21:02 +0200
Re: socket.create_connection() ipv4 oder ipv6? Ulli Horlacher <framstag@rus.uni-stuttgart.de> - 2019-06-29 20:21 +0000
csiph-web