Squeak and Multicast?

Ian Piumarta ian.piumarta at inria.fr
Tue Jul 23 04:29:49 UTC 2002


On Tue, 23 Jul 2002, Andreas Raab wrote:

> Multicast is supported by the latest Windows VM

I've added IP_{ADD,DROP}_MEMBERSHIP to the list of known options in the
3.2-5 Unix VM (conditional on them being defined in in.h of course).

> though the interface is a bit obscure.

Not really, considering...  ;)

> You will have to pass byte arrays to Socket>>setOption:to:
[...]
> 	socket setOption: 'IP_ADD_MEMBERSHIP'
> 		to: (ByteArray with: 234 with: 5 with: 6 with: 7
> 		               with: 1 with: 2 with: 3 with. 4).

In Unix you *must* pass all 8 bytes.  (No biggie: the address returned by
localHostAddress will probably work just fine.)  If anyone cares, here's
why:

That ByteArray is really a `struct ip_mreq'.  These are eight bytes long
(4 bytes IPv4 group address + 4 bytes i/f address, both in network order).  
To avoid an unholy proliferation of special cases, the primitive (having
decided you didn't send it String containing just $1 or $0) simply passes
the bytes you gave it verbatim to setsockopt (in the hope that it
corresponds vaguely to the int or struct or whatever it is that the option
expects) padded right to 32 bytes with zero.  Since 0.0.0.0 is probably
not a valid interface on your machine (and more's to the point since
IP_ADD_MEMBERSHIP barfs bad if you give it an argument that hasn't got a
sizeof(ip_mreq) anyhow) you have to supply the interface address for real.

> Same for IP_DROP_MEMBERSHIP. Multicast support has been tested
> successfully though not agressively.

Ditto.

You'll need to fetch -5devel if you want these options recognised.  (The
nightly build has by now probably updated the tarballs and rpms with the
above modifications.)

Tchao,

Ian

PS John: if you want to test the Mac VM you might try joining/leaving
   all-systems.mcast.net (224.0.0.1).




More information about the Squeak-dev mailing list