Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion tekmar_packetserv/rootfs/usr/local/packetserv/packetserv.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ def check_thread_alive(thr):
return thr.is_alive()


# ******************************************************************************
def get_container_ip():
# determine which interface the OS would route through
with socket.socket(socket.AF_INET, socket.SOCK_DGRAM) as s:
s.connect(("8.8.8.8", 80))
return s.getsockname()[0]


# ******************************************************************************
class Connection:
"""Container for a socket and its address.
Expand Down Expand Up @@ -222,7 +230,7 @@ def stop(self):
ser_host = os.environ.get("SERIAL_SRV_HOST")
ser_port = os.environ.get("SERIAL_SRV_PORT")
env_ipv4_acl = os.environ.get("IP4_ACL")
host_addr = "0.0.0.0"
host_addr = get_container_ip()
port_id = 3000
ip4_acl = ipaddress.IPv4Network(env_ipv4_acl)

Expand Down
Loading