Skip to content

Commit

Permalink
Use correct socket API to retrieve local IP address for Service
Browse files Browse the repository at this point in the history
Fixes #2200
  • Loading branch information
papr committed Oct 25, 2021
1 parent b9d7aa1 commit de5a17c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pupil_src/shared_modules/service_ui.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,17 @@ def reset_restart():

g_pool.menubar.append(ui.Button("Reset window size", set_window_size))

pupil_remote_addr = "{}:{}".format(
socket.gethostbyname(socket.gethostname()), g_pool.preferred_remote_port
)
for *_, (ip, port, *_) in socket.getaddrinfo(
"localhost",
g_pool.preferred_remote_port,
family=socket.AF_INET,
type=socket.SOCK_STREAM,
):
pupil_remote_addr = f"{ip}:{port}"
break
else:
pupil_remote_addr = "unknown"

g_pool.menubar.append(
ui.Text_Input(
"pupil_remote_addr",
Expand Down

0 comments on commit de5a17c

Please sign in to comment.