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.

Using setsockopt() with IP_ADD_MEMBERSHIP option

Hi, all

I program network application with evm6670,ndk.

when I use setsockopt() function with   IP_ADD_MEMBERSHIP  option for multicasting,  setsockopt() function return EINVAL code.

NDK  programmer's guide say that this error result from wrong paramter. but I cann't find what I do wrong 

How can I resolve it?

 

    imr.imr_multiaddr.s_addr = multiAddr.s_addr;
    imr.imr_interface.s_addr = interfaceAddr.s_addr;

    if( setsockopt(netPath->eventPcb, IPPROTO_IP, IP_ADD_MEMBERSHIP,(void *)&imr,sizeof(imr)) < 0)
     {
        ERROR("netInit: failed to join the multi-cast group, ErrNo: %d",fdError(netPath->eventPcb));
    }