3Super simple UDP test - bind to USB interface specifically
12result = subprocess.run(
13 [
"ip",
"addr",
"show",
"enx00e04c680240"], capture_output=
True, text=
True
16for line
in result.stdout.split(
"\n"):
17 if "inet " in line
and "192.168" in line:
18 usb_ip = line.split()[1].
split(
"/")[0]
22 print(
"❌ USB interface (enx00e04c680240) has no IP!")
23 print(
"Assign one: sudo ip addr add 192.168.2.201/24 dev enx00e04c680240")
26print(f
"=== Simple UDP Test ===")
27print(f
"USB Interface IP: {usb_ip}")
28print(f
"Binding to: {usb_ip}:5006")
31sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
32sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
35 sock.bind((usb_ip, 5006))
36 print(f
"✅ Bound to {usb_ip}:5006")
38 print(
"Listening for packets (30 seconds)...")
39 print(
"Send packets from your board now!")
50 data, addr = sock.recvfrom(4096)
52 print(f
"[{packet_count}] From {addr[0]}:{addr[1]}, size: {len(data)} bytes")
54 hex_str =
" ".join(f
"{b:02x}" for b
in data)
55 print(f
" Data: {hex_str}")
56 except socket.timeout:
61 print(f
"✅ Received {packet_count} packet(s)!")
63 print(
"❌ No packets received")
65 print(
"Troubleshooting:")
66 print(f
" 1. Verify board sends to: {usb_ip}:5006")
67 print(f
" 2. Check interface: ip addr show enx00e04c680240")
68 print(f
" 3. Test ping: ping {usb_ip} (from board)")
71 print(f
"❌ Error: {e}")
73 print(
"Try binding to 0.0.0.0 instead:")
75 " python3 -c \"import socket; s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM); s.bind(('0.0.0.0', 5006)); print('Bound to 0.0.0.0:5006'); data, addr = s.recvfrom(4096); print(f'Received from {addr}: {len(data)} bytes')\""
static std::vector< string_t > split(const string_t &reference_string)
split the string input to reference tokens
TOML_NODISCARD_CTOR time() noexcept=default