21.8 dg_cli Function Using Multicasting
We modify our dg_cli function from Figure 20.5 by just removing the call to setsockopt. As we said earlier, none of the multicast socket options needs to be set to send a multicast datagram if the default settings for the outgoing interface, TTL, and loopback option are acceptable. We run a modified UDP echo server that joins the allhosts group, then run our program specifying the all-hosts group as the destination address.
macosx % udpcli01 126.96.36.199
from 172.24.37.78: hi there
from 172.24.37.94: hi there
We get a response from both systems on the subnet. They are each running the multicast echo server. Each reply is unicast because the source address of the request, which is used by each server as the destination address of the reply, is a unicast address.
IP Fragmentation and Multicasts
We mentioned at the end of Section 20.4 that most systems do not allow the fragmentation of a broadcast datagram as a policy decision. Fragmentation is fine to use with multicasting, as we can easily verify using the same file with a 2,000-byte line.
macosx % udpcli01 188.8.131.52 < 2000line
from 172.24.37.78: xxxxxxxxxx[...]
from 172.24.37.94: xxxxxxxxxx[...]