Files
mommysgoodpuppy e4f3e651c5 Add in-VR camera setup and resilient live calibration
Expose calibration and recording controls in the wrist menu, preserve progress across grip changes, fix OSC discovery alongside other receivers, and improve camera-layer scene delivery and pacing. Document v0.0.12 and cover camera calibration, discovery and menu behavior.

Agent: Codex CLI 0.163.0; model gpt-6.1-sol; thread 01a14f56-a3aa-7bc2-9833-db8463ce54fa
2026-10-18 18:25:58 +03:00

19 lines
876 B
TypeScript

/** Keep the conventional OSC output port when free; OSCQuery advertises the actual port. */
export function listenOscReceiver(preferredPort: number): Deno.DatagramConn {
try {
return Deno.listenDatagram({ port: preferredPort, transport: "udp" });
} catch (error) {
if (!(error instanceof Deno.errors.AddrInUse)) throw error;
// Face/eye tracking software commonly owns 9001. Do not share its socket or stop it.
// Prefer a repeatable port so a receiver restart does not invalidate clients' caches.
for (let port = preferredPort + 1; port <= Math.min(preferredPort + 10, 65535); port++) {
try {
return Deno.listenDatagram({ port, transport: "udp" });
} catch (nextError) {
if (!(nextError instanceof Deno.errors.AddrInUse)) throw nextError;
}
}
return Deno.listenDatagram({ port: 0, transport: "udp" });
}
}