MCPcopy Create free account
hub / github.com/microsoft/debugpy / can_bind_ipv6_localhost

Function can_bind_ipv6_localhost

src/debugpy/common/sockets.py:24–34  ·  view source on GitHub ↗

Check if we can bind to IPv6 localhost.

()

Source from the content-addressed store, hash-verified

22 return False
23
24def can_bind_ipv6_localhost():
25 """Check if we can bind to IPv6 localhost."""
26 try:
27 sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
28 sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
29 # Try to bind to IPv6 localhost on port 0 (any available port)
30 sock.bind(("::1", 0))
31 sock.close()
32 return True
33 except (socket.error, OSError, AttributeError):
34 return False
35
36def get_default_localhost():
37 """Get the default localhost address.

Callers 1

get_default_localhostFunction · 0.85

Calls 1

closeMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…