major refactoring
This commit is contained in:
@ -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
|
||||
|
||||
Reference in New Issue
Block a user