It is currently Tue, 25 Apr 2017 04:12:58 GMT

Author Message
 (IP_MULTICAST_IF) Multicast and Linux !?

Hi there,
is there anyone who can suggest me how to fix this problem?
I've just tried to implement a client that send datagrams to a multicast
Basically the source code you find below it's a function that creates a
socket and set IP_MULTICAST_IF flag at the IP level of the socket.
When a try to run it I get the following message:
"initsocketss(): setsockopt IP_MULTICAST_IF failed: Cannot assign
requested address"
I read some messages in the newsgroup about people having the same
problem, but I didn't find any answer.
Other steps that I followed were:

I'm using Linux Red Had 2.0.31
Do you have any idea about what I missed !?
Thanx a lot.


void initsockets(){
    struct ip_mreq imr;
    int enable = 1;
    imr.imr_multiaddr.s_addr = inet_addr(ALLMOBAGENTS);/* */
    /* If no interface is specified then
       the interface leading to the default route is used.*/

    imr.imr_interface = terminalIPaddress;

    RegisterMesckt = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
< 0){
          printf ("Error setting REUSEADDR option \n");

    if (setsockopt(RegisterMesckt, IPPROTO_IP, IP_MULTICAST_IF
                  (char *)&imr, sizeof(struct ip_mreq)) < 0)  {
            perror("initsockets(): setsockopt IP_MULTICAST_IF failed");

 Sun, 03 Dec 2000 03:00:00 GMT   
 (IP_MULTICAST_IF) Multicast and Linux !?

So what does your ifconfig report?  Mine reports flags as follows:

Is your kernel multicast-enabled?  If not, you will have to rebuild it:

If your machine has 2 network cards and you want mcast groups on
either side, you should also set:

...but I could never get this to work properly, at least on 2.0.30 :-(
(Although I posted to this group at the time, I got no response.  AFAIR
my problem was that packets originating at the host were only sent out
on one side although both sides contained group members.  Forwarding
between the sides worked fine.)

Stephen Crane, Dept of Computing, Imperial College of Science, Technology and
Medicine, 180 Queen's Gate, London sw7 2bz, UK:jsc@{, icdoc.uucp}

 Mon, 04 Dec 2000 03:00:00 GMT   
   [ 2 post ] 

Similar Threads

1. Linux multicast is slower than Windows multicast ?

2. IP_MULTICAST_IF: address not bound to any interface

3. setsockopt with IP_MULTICAST_IF option

4. multicasting tools on linux/unix

5. Linux IPv4 Multicast question

6. linux command to issue a join for a host participating in multicast grroup

7. Multicast stops working (timeout) on Linux router

8. Forwarding multicast packets in Linux, for different subnets.

9. Howto enable multicast forwarding on Linux

10. multicast routing with linux.

Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software