I did something like below to set up the socket.
int ttl = 2;
ip_mreq mreq;
inet_aton("224.0.0.10", &mreq.imr_multiaddr);
mreq.imr_interface.s_addr = my_node_id;
setsockopt(udp_sock, IPPROTO_IP, IP_ADD_MEMBERSHIP, &mreq, sizeof mreq);
setsockopt(udp_sock, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof ttl);
And to send, I did
inet_aton("224.0.0.10", &sin.sin_addr);
sendto(udp_sock, buf, len);
By the way, all the machines run Linux 2.0.35 or 36
Also, is there a good page for learning multicast?
Thanks,
yasushi