Ok, I have a udp socket (C network programming), and want to specify what interface to use (which physical interface on the machine).
I have the following:
index = if_nametoindex(mydevice);
if(setsockopt((int)socketfd, IPPROTO_IP, IP_BOUND_IF, &index, sizeof(index)) < 0)
That seems to not return an acceptable response. Does anyone have insight into specifying the appropriate network interface (short of using bind, which since this is connectionless, shouldn't be needed).
If UDP, you want IPPROTO_UDP. You're using the enums for "raw", and will get IP level datagrams instead of UDP level datagrams.
If you're reading UDP (datagrams), you will need to bind a receive port (otherwise, how would you be able to receive specific datagrams?).
Without seeing the rest of your code, not sure what the problem could be.
I'm assuming you're doing unicast UDP, not multicast (UDP) or broadcast (UDP).
Cliff
