Roku Developer Program

Developers and content creators—a complete solution for growing an audience directly.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
Level 7

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
Highlighted
Level 7

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
Highlighted
Level 7

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
Highlighted
Level 7

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