zsx / r3

Rebol (R3) source code
Apache License 2.0
36 stars 7 forks source link

Lack of UDP multicast support #38

Open gchiu opened 7 years ago

gchiu commented 7 years ago

This type of code https://gist.github.com/gchiu/9a6c16ce0bbc3ecc5be4455c3e096832 I think should show some SSDP activity but nothing happens. Similar code for Rebol2 sees SSDP network activity being broadcast.

hostilefork commented 7 years ago

Fundamentally this sounds like it needs either 1, 2, or 3 ways to get in a call to setsockopt:

1 call: Bare bones; affects the listening side of a UDP connection only, listener asks to join a multicast group.

2 calls: If you care to have a way to leave the group also, there needs to be a way to ask for that.

3 calls: If it's important to get the sender to be able to request a more aggressive transmission of multicast beyond its subnet.

So not a lot of C, but it could be wily to figure out exactly where to put it. And I don't really know a whole lot about the intention of the polling and waiting model, so @zsx might chime in on that.

But here's a short summary of what I've figured out:

hostilefork commented 7 years ago

I've adapted some sample code on the Internet for implementing multicast in C. It's a simple listener and a simple sender.

They successfully send to each other, but also sender.c is able to get messages to a Rebol2 multicast listener on both Linux and Windows:

https://gist.github.com/hostilefork/f7cae3dc33e7416f2dd25a402857b6c6

So that is pretty much proof of concept. The only question is how to get those C calls grafted into the network code, triggered from Rebol.