Skip to content

Commit 5c2e0be

Browse files
committed
socket: Support "" as host addr, meaning INADDR_ANY (0.0.0.0).
1 parent 9643541 commit 5c2e0be

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

socket/socket.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ def _resolve_addr(addr):
1212
return addr
1313
if len(addr) != 2:
1414
raise NotImplementedError("Only IPv4 supported")
15-
a = getaddrinfo(addr[0], addr[1], _socket.AF_INET)
15+
a = "0.0.0.0" if addr[0] == "" else addr[0]
16+
a = getaddrinfo(a, addr[1], _socket.AF_INET)
1617
return a[0][4]
1718

1819
def inet_aton(addr):

0 commit comments

Comments
 (0)