Skip to content

Commit cef0738

Browse files
committed
example/http_client.py: Remove unused code.
1 parent cf4b72b commit cef0738

1 file changed

Lines changed: 3 additions & 13 deletions

File tree

examples/network/http_client.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,9 @@
66

77
s = _socket.socket()
88

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)
9+
ai = _socket.getaddrinfo("google.com", 80)
10+
print("Address infos:", ai)
11+
addr = ai[0][4]
2212

2313
print("Connect address:", addr)
2414
s.connect(addr)

0 commit comments

Comments
 (0)