We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent cf4b72b commit cef0738Copy full SHA for cef0738
1 file changed
examples/network/http_client.py
@@ -6,19 +6,9 @@
6
7
s = _socket.socket()
8
9
-if 1:
10
- ai = _socket.getaddrinfo("google.com", 80)
11
- print("Address infos:", ai)
12
- addr = ai[0][4]
13
-else:
14
- # Deprecated ways to construct connection address
15
- addr = _socket.sockaddr_in()
16
- addr.sin_family = 2
17
- #addr.sin_addr = (0x0100 << 16) + 0x007f
18
- #addr.sin_addr = (0x7f00 << 16) + 0x0001
19
- #addr.sin_addr = _socket.inet_aton("127.0.0.1")
20
- addr.sin_addr = _socket.gethostbyname("google.com")
21
- addr.sin_port = _socket.htons(80)
+ai = _socket.getaddrinfo("google.com", 80)
+print("Address infos:", ai)
+addr = ai[0][4]
22
23
print("Connect address:", addr)
24
s.connect(addr)
0 commit comments