Skip to content

Commit

Permalink
Merge pull request #2201 from pupil-labs/fix_gethostname
Browse files Browse the repository at this point in the history
Use correct socket API to retrieve local IP address for Service
  • Loading branch information
papr committed Oct 26, 2021
2 parents b9d7aa1 + de5a17c commit 7f56765
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions pupil_src/shared_modules/service_ui.py
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 7f56765

Please sign in to comment.