major refactoring

This commit is contained in:
2025-10-06 11:21:03 +02:00
parent 5f18aab285
commit 0019644e61
5 changed files with 1231 additions and 656 deletions

View File

@ -30,7 +30,16 @@ def forward(source_socket):
label = "A→B" if addr == DEVICE1_ADDR else "B→A"
if addr != DEVICE1_ADDR and addr != DEVICE2_ADDR:
label = f"unknown {addr}"
# Forward to other player
sock_from_A.sendto(data, (target_ip, 5000))
# Also forward to app.py tracking listener on port 5002
# Prepend source IP so app.py can identify which player sent the data
source_ip = addr[0]
tagged_data = f"SOURCE_IP:{source_ip}|".encode('utf-8') + data
sock_from_A.sendto(tagged_data, ("127.0.0.1", 5002))
timestamp = datetime.now().strftime("%H:%M:%S")
# Logging