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.

Setup broadcast / multicast UDP with NDK

I'm trying to setup broadcast / multicast UDP using the NDK and having some trouble - specifically on how to receive.

My local network on the DSP (6670) is 192.168.0.1 and am able to send a broadcast packet out to 192.168.0.255. I'm able to capture the output in wireshark and can see the packet and has the MAC address FF:FF:FF:FF:FF:FF. I did have to enable the socket option SO_BROADCAST to make this work. I happen to be using port 1030.

Now if the DSP receives a packet that has the destination address 192.168.0.255 port 1030, I'm unable to see it on the socket that is able to send the messages. I've read that I may need to set the IP_ADD_MEMBERSHIP option but I'm unable to add that option successfully (I keep getting error 22 "invalid arguments").

How do I setup the DSP to receive broadcast messages? Do I need a separate socket to receive broadcast messages or can the existing socket bound to 192.168.0.1 port 1030 receive them?

Thanks,
Raj

  • Rajan Patel,

    The NDK based helloworld example having UDP recv socket thread.
    C:\ti\mcsdk_2_xx_xx_xx\examples\ndk\helloWorld\evmc6670l
    And also the UDP socket reference code is available at the below files and the task name is "UDP_perform_receive".
    C:\ti\mcsdk_2_xx_xx_xx\demos\hua\src\benchmark\ndkbenchmark.c
    C:\ti\mcsdk_2_xx_xx_xx\demos\hua\src\benchmark\ndkloopback.c

    These files will be helpful to write the code for UDP send/receive the packets.

  • Rajan Patel,

    Did you find the UDP socket example code as mentioned last post? Is it useful for you?

    Do you need any further follow-up on this? If not, please help to close this thread.