default value for IP_MULTICAST_TTL?

default value for IP_MULTICAST_TTL?

Post by oliver.kowa.. » Fri, 24 Mar 2006 23:27:07

I was debbuging for awile because my multicast packages I've sended
were not received on other hosts.
I figured out that a value of 1 of IP_MULTICAST_TTL was the reason for
the failure - restriction to local subnet.

What suggest you which value should I choose by default vor
IP_MULTICAST_TTL (for instance if you are programming a networking



1. IP multicast: IP_MULTICAST_TTL option

I have been experimenting with IP multicasts.  I got them working between
hosts on the same subnet so I tried getting them to work between subnets.
I use the program below to send a message.  Whenever I run it, I get
the following error message:

setsockopt IP_MULTICAST_TTL: Option not supported by protocol

What is going wrong?

(I think I have multicast routing turned on in our Cisco routers,
but I have not gotten far enough so that makes any difference.)

Environment:  Solaris 2.4 from the 11-94 CD with no patches installed
    various Sparcs (SS1, IPC, SS5)

Running as root

 * Program to send a multicast message
 * Bruce Orchard, June 14, 1995

#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

static char msg_text[] = {"ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"};
static struct sockaddr_in dest_addr;

main (int argc, char *argv[]) {
    int raw_socket, udp_socket, status, ttl;
    struct ip_mreq mr;

    udp_socket = raw_socket = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
    if (udp_socket < 0) {
        perror ("socket");
        exit (1);
    mr.imr_multiaddr.s_addr = 0xE000C7C7;
    mr.imr_interface.s_addr = INADDR_ANY;
    status = setsockopt (raw_socket, IPPROTO_IP, IP_ADD_MEMBERSHIP,
        (char *) (&mr), sizeof (mr));
    if (status < 0) {
        perror ("setsockopt IP_ADD_MEMBERSHIP");
        exit (2);
    ttl = 5;
    status = setsockopt (raw_socket, IPPROTO_IP, IP_MULTICAST_TTL,
        (char *) (&ttl), sizeof (ttl));
    if (status < 0) {
        perror ("setsockopt IP_MULTICAST_TTL");
        exit (2);
    dest_addr.sin_addr.s_addr = 0xE000C7C7;
    dest_addr.sin_port = 999;
    status = sendto (udp_socket, msg_text, sizeof (msg_text), 0, (struct sockaddr *) &dest_addr, sizeof (dest_addr));
    if (status < 0) {
        perror ("sendto");
        exit (1);

2. deadly linux freeze: HELP

3. setsockopt() with IP_MULTICAST_TTL and IP_MULTICAST_LOOP

4. lpd challenge: remote printing with local filtering

5. Default nice values

6. setenv

7. system-wide UMASK default value

8. 2 Stupid questions

9. Where can I find the default value of HZ

10. default value problem in sh script!

11. grub default values

12. Default value of rlim_fd_cur

13. How to set default nice value?