#!/bin/bash # Debug script for ETCP two instances test echo "=== ETCP Socket Debug Test ===" # Start the test in background echo "Starting test..." timeout 15 ./test_etcp_two_instances > test_debug.log 2>&1 & TEST_PID=$! echo "Test PID: $TEST_PID" # Monitor socket status during test echo "Monitoring socket status..." for i in {1..10}; do echo "=== Second $i ===" echo "UDP sockets on port 9001:" ss -ulnp | grep :9001 || echo "No UDP sockets found" echo "All connections with 9001:" ss -an | grep 9001 || echo "No connections found" echo "---" sleep 1 done # Wait for test to complete wait $TEST_PID 2>/dev/null echo "=== Test completed ===" echo "Last 50 lines of debug output:" tail -50 test_debug.log | grep -E "(ETCP|socket|fd=|127.0.0.1:9001)" echo "=== Full debug log saved to test_debug.log ==="