This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C6671 ndk multicast

Expert 1060 points
Other Parts Discussed in Thread: SYSBIOS

Dear expert.

I'm using C6671 + sysbios with NDK _2_21_01_38.

I need a multicast function, but there's some problem.

 

To use Multicast, my application calls setsockopt() as below.

 

          group.imr_multiaddr.s_addr = inet_addr("224.0.1.129");

          group.imr_interface.s_addr = inet_addr("192.168.20.6");

          if (setsockopt(sd, IPPROTO_IP, IP_ADD_MEMBERSHIP, (char *)&group, sizeof(group)) < 0) {

              perror("adding multicast group");

              close(sd);   

              exit(1);

           }

 

When I keep following the setsockopt(), i met belows function. It seems register the multicast class D addr.

 

ndk_2_21_01_38/packages/ti/ndk/stack/igmp/igmp.c

static uint IGMPDoMCast( uint IfIdx, IPN IpAddr, uint fAdd )

{

     if (fAdd)

        {

             /* Add a multicast address; we are already in kernel mode hence we can directly call the

              * Device specific IOCTL function. */

            if (ptr_device->ioctl (ptr_device, NIMU_ADD_MULTICAST_ADDRESS, (void *)&bMacAddr[0], 6) < 0)

            {

                 /* The Device specific IOCTL Failed. Pass back the error... */

                 return 0;

            }

            /* Multicast address was successfully added to the Device Multicast List  */

            return 1;

        }

}

 


 

And the IOCTL calls below Emacioctl function in nimu_eth.c.

 

static int Emacioctl (NETIF_DEVICE* ptr_net_device, uint cmd, void* pBuf, uint size)

{

         return 0;

}

 

There are no Emacioctl implementation.

This is why multicast doesn't work.

 

Please check if it is right, give some example for multicast. Otherwise let me know right direction.

Best regards.

Jay.

  • Jay,

    There is a test case MulticastTest() under ndk_2_22_02_16\packages\ti\ndk\tools\console\contest.c. I followed the setsockopt() ----->SockSet()------>IGMPJoin()------->IGMPJoinHostGroup()------>IGMPDoMCast()-------->Emacioctl() and found this is an empty function in the nimu_eth.c. I will check why.

    Regards, Eric

  • Jay,

    I want to check with you:

    if this function is empty and return 0. Then if (ptr_device->ioctl (ptr_device, NIMU_ADD_MULTICAST_ADDRESS, (void *)&bMacAddr[0], 6) < 0) will return 1 for success. Then setsockop will pass. So, what would be the problem in your multicast failure case? How do you trace this to setsockop failure due to the empty ioctl function in NIMU driver?

    Regards, Eric