Skip to content

Commit

Permalink
Hub: Accept Both IPv4 and IPv6 Connections
Browse files Browse the repository at this point in the history
The tutorial doesn't work, if the exporter accepts IPv6 connections, but
the Hub doesn't.
  • Loading branch information
holesch committed Aug 16, 2024
1 parent ddfaad9 commit a70fc83
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions not_my_board/_hub.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@ def run_hub():

import uvicorn

with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
with socket.socket(socket.AF_INET6, socket.SOCK_STREAM) as s:
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, True)
s.setsockopt(socket.IPPROTO_IPV6, socket.IPV6_V6ONLY, False)

host = "0.0.0.0" # noqa: S104
host = "::"
port = 2092
s.bind((host, port))

Expand Down

0 comments on commit a70fc83

Please sign in to comment.