fix: add --bind flag for Windows firewall compatibility
Windows firewall blocks UDP on 0.0.0.0 — must bind to specific WiFi IP. - seed_csi_bridge.py: --bind-addr auto (auto-detects WiFi IP) - rf-scan.js: --bind <ip> option (default 0.0.0.0, use 192.168.1.x on Windows) Confirmed: 195 frames received from both ESP32 nodes with --bind 192.168.1.20 Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
parent
4fc491dea5
commit
85417b84a6
|
|
@ -25,6 +25,7 @@ const { parseArgs } = require('util');
|
||||||
const { values: args } = parseArgs({
|
const { values: args } = parseArgs({
|
||||||
options: {
|
options: {
|
||||||
port: { type: 'string', short: 'p', default: '5006' },
|
port: { type: 'string', short: 'p', default: '5006' },
|
||||||
|
bind: { type: 'string', short: 'b', default: '0.0.0.0' },
|
||||||
duration: { type: 'string', short: 'd' },
|
duration: { type: 'string', short: 'd' },
|
||||||
json: { type: 'boolean', default: false },
|
json: { type: 'boolean', default: false },
|
||||||
interval: { type: 'string', short: 'i', default: '2000' },
|
interval: { type: 'string', short: 'i', default: '2000' },
|
||||||
|
|
@ -573,7 +574,9 @@ function main() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
server.bind(PORT);
|
// On Windows, binding to 0.0.0.0 may be blocked by firewall.
|
||||||
|
// Use --bind <ip> to specify your WiFi IP (e.g., --bind 192.168.1.20)
|
||||||
|
server.bind(PORT, args.bind);
|
||||||
|
|
||||||
// Periodic display update
|
// Periodic display update
|
||||||
const displayTimer = setInterval(display, INTERVAL_MS);
|
const displayTimer = setInterval(display, INTERVAL_MS);
|
||||||
|
|
|
||||||
|
|
@ -391,7 +391,16 @@ def run_bridge(args):
|
||||||
# Open UDP listener
|
# Open UDP listener
|
||||||
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
|
||||||
sock.bind(("0.0.0.0", args.udp_port))
|
bind_addr = args.bind_addr
|
||||||
|
if bind_addr == "auto":
|
||||||
|
try:
|
||||||
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
|
s.connect(("192.168.1.1", 80))
|
||||||
|
bind_addr = s.getsockname()[0]
|
||||||
|
s.close()
|
||||||
|
except Exception:
|
||||||
|
bind_addr = "0.0.0.0"
|
||||||
|
sock.bind((bind_addr, args.udp_port))
|
||||||
sock.settimeout(1.0) # 1s timeout for responsive time-based flushing
|
sock.settimeout(1.0) # 1s timeout for responsive time-based flushing
|
||||||
log.info(
|
log.info(
|
||||||
"Listening on UDP port %d (batch size: %d, flush interval: %.0fs)",
|
"Listening on UDP port %d (batch size: %d, flush interval: %.0fs)",
|
||||||
|
|
@ -597,6 +606,11 @@ def main():
|
||||||
default=5006,
|
default=5006,
|
||||||
help="UDP port to listen on (default: 5006)",
|
help="UDP port to listen on (default: 5006)",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"--bind-addr",
|
||||||
|
default="auto",
|
||||||
|
help="Bind address for UDP listener (default: auto-detect WiFi IP; use 0.0.0.0 for all interfaces)",
|
||||||
|
)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--batch-size",
|
"--batch-size",
|
||||||
type=int,
|
type=int,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue