Roku Developer Program

Join our online forum to talk to Roku developers and fellow channel creators. Ask questions, share tips with the community, and find helpful resources.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
eswarbala
Visitor

Multicast problem

I wrote a simple program to send a UDP datagram to a multicast address , but the packet never shows up in wireshark traces both at the receiver end and Roku end.

I tried just modifying the socket_test example (UDP client) to send to a multicast address ex:224.0.0.1 and still dont see the packet.

All I am doing is
* create roDatagramSocket
* create socketaddress with address set to a multicast ip and a port (ex:224.0.0.1:1000)
* call setSendToAddress on the socket and
* call sendStr on the socket. - sendstr returns > 0 signifying success
* I don't see this packet out of Roku in network traces.

Am I missing anything?

Any help is appreciated

thanks
0 Kudos
3 REPLIES 3
eswarbala
Visitor

Re: Multicast problem

Here is my configuration if it makes a difference:
Roku (not Gen 2) running Software v3.1
Using 4.1 SDK
0 Kudos
eswarbala
Visitor

Re: Multicast problem

OK. I figured out the issue.

If you dont set the hostname on the socket or set the roSocketAddress' hostname (roSocketAddress.setHostname) to 0.0.0.0 it does not work. You have to explicitly set the hostname to ip address of roku and then multicast works fine.
0 Kudos
RokuMEmerson
Visitor

Re: Multicast problem

My tests don't require setting the local address of the socket. The following code works for me:

port = CreateObject("roMessagePort")

ssdpAddress = "239.255.255.250"
ssdpPort = 1900

groupAddr = CreateObject("roSocketAddress")
groupAddr.setAddress(ssdpAddress)
groupAddr.setPort(ssdpPort)

search = CreateObject("roDatagramSocket")
search.setSendToAddress(groupAddr)
search.setMulticastTTL(1)
search.setMessagePort(port)
search.notifyReadable(true)

search.sendStr("MSEARCH ...")

...
msg = wait(<timeout>, port)
...
0 Kudos
Need Assistance?
Welcome to the Roku Community! Feel free to search our Community for answers or post your question to get help.

Become a Roku Streaming Expert!

Share your expertise, help fellow streamers, and unlock exclusive rewards as part of the Roku Community. Learn more.