Sendto returns -1 and errno 22 (Invalid argument), when set the multicast outgoing interface by ip_mreqn

view story

http://stackoverflow.com – I faced an issue, when I try to send to multicast group by setting the intended outgoing interface by the code bellow, Actually when the condition is TRUE (if(config.enable_if == 1)) the sendto system call returns error Invalid Argument, but if the condition was False sendto send data and doesn't generate any error. Please Anyone has an idea, or should I modify anything in my code? /* Create a datagram socket on which to send. */ sd = socket(AF_INET, SOCK_DGRAM, 0); /* Set local interface for outbound multicast datagrams. */ /* The IP address specified must be associated wi (HowTos)