Skip to content

Add network interface selection for multicast send/receive.#16

Open
tychedelia wants to merge 2 commits into
madmappersoftware:mainfrom
tychedelia:local-address-interface
Open

Add network interface selection for multicast send/receive.#16
tychedelia wants to merge 2 commits into
madmappersoftware:mainfrom
tychedelia:local-address-interface

Conversation

@tychedelia

Copy link
Copy Markdown

We were testing PONK connectivity over WLAN between two computers from Modulaser into the default TouchDesigner receiver included in the repo and weren't able to get things working until I hard-coded the UDP socket to bind to my wifi interface. This is because on windows, wifi almost never has the correct metrics to be selected first when using INADDR_ANY, which means our multicast messages don't get delivered.

These changes switch to allowing both the sender and receiver to select a specific interface, falling back to default INADDR_ANY behavior. This mirrors other Touch UDP operators (e.g. Osc In/Out).

I've tested this locally via multiple interfaces but haven't validated computer to computer for sure but things seem to work as expected.

SpaceK33z added a commit to ModulaserApp/ponk-protocol that referenced this pull request Jul 13, 2026
* feat(examples): allow selecting the multicast interface

The send_multicast and receive_reassemble examples hardcoded INADDR_ANY,
so on Windows a Wi-Fi interface is often not selected by default and PONK
multicast never crosses the WLAN. Both examples now take an optional local
interface IPv4 address: the sender binds to it to pin egress, the receiver
joins the group on it. Omitting the address preserves the previous
all-interfaces behavior; an unparseable address warns and falls back.

Interface selection stays an application-level policy in the examples,
keeping the codec socket-agnostic and unsafe-free. Ports the intent of
madmappersoftware/Ponk#16 to this Rust crate's I/O-owning layer.

* fix(examples): fail hard on an invalid interface address

A typo in the interface argument silently reverted to INADDR_ANY — the
exact default-selection behavior the argument exists to override — so the
example looked broken over WLAN rather than reporting the typo. An invalid
address is now a hard error; a missing argument still defaults to all
interfaces. Also scope the sender's bind() comment: it reliably steers
multicast egress on Windows, but binding a unicast source address is not
IP_MULTICAST_IF and is only a hint on other platforms.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants