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: 
greubel
Visitor

UDP Broadcast Responses

I have three different Roku boxes.

Model Type Software Version
1. HD N1000 3.1 build 1011 013.01E01011A
2. XDS 2100X 3.1 build 1011 013.01E01011A
3. Roku 2 3100X 4.3 build 1039 024.03E01039A

I am trying to implement broadcast discovery for my app and all three boxes act differently.
Using the same code, I get responses for the UDP broadcast M-SEARCH from the HD and Roku2.
I also get periodic NOTIFY responses but only on the Roku2.

The XDS gets nothing ????

I wrote a simple test routine to send and receive normal UDP datagrams and all the boxes
respond correctly.

Question: Is something missing from the XDS box or do I need to turn something on ?
0 Kudos
14 REPLIES 14
EnTerr
Roku Guru

Re: UDP Broadcast Responses

No, based on my experience i bet the behavior is caused by the router you have and how players are connected to it (i.e. wired or wireless).

Try connecting XDS wired if it was wireless, also try changing WiFi secutity (WPA vs WEP vs open). Share the results
0 Kudos
greubel
Visitor

Re: UDP Broadcast Responses

Tried some things.
1. Switched XDS to wired, the M-Search worked but still no NOTIFY responses.
2. Moved XDS close to router as wireless, no effect.
3. Upgraded router (NETGEAR WNR3500-1v) firmware to latest version, no effect.
4. Changed router to Open, no effect on the XDS, others OK.
5. Tried security options: Open, WEP, WPA-PSK [TKIP], WPA2-PSK [AES], WPA-PSK [TKIP] + WPA2-PSK [AES] - no effect !

Roku shows wireless connection to be excellent.
0 Kudos
EnTerr
Roku Guru

Re: UDP Broadcast Responses

IMNSHO, it's a given that Netgear firmware is a PoS (a unit of future compost). Why it is so bad, I don't know - I have gone through multiple routers and Linksys, Motorola, D-link, Belkin together have caused me less headaches with NAT and port mapping than Netgear does. Must be something with their developers but i don't know anything other than the software is written in India (and Linksys fw was being done in Taiwan). OTOH, Netgear are solid as hardware - i recommend their powerline networking and probably anything that has no complicated software in it. That's my personal unscientific opinion.

Now back to the problem at hand. I skimmed over a manual for WNR3500 (http://www.upc.nl/pdf/upc-handleiding-n ... nr3500.pdf) and there is nothing helpful there on broadcast/multicast/SSDP there. There is option about UPnP however (see 5-12) - try enabling it and testing that way, even if UPnP when we speak routers is used to map internal/external ports, it does use SSDP and may as side effect fix your problem, so try it.

Why is SSDP so problematic over WiFi - turns out multicast/broadcast of datagrams have to be emulated by the router - when host sends packet, router has to forward it separately to each other known host - this in contrast with the approach in Ethernet where all hosts can just listen for it on the common media. Because of that special handling, turns out there are multiple routers in which multicast over WiFi is broken.

PS. somebody else's voes: http://forum1.netgear.com/showthread.php?t=68257
0 Kudos
greubel
Visitor

Re: UDP Broadcast Responses

I do have UPnP enabled in the router. I'm thinking it has to be something in the XDS because I'm able to do a M-SEARCH from a PC and a MAC and the box responds with the Roku ECP data. Also other devices don't have a problem detecting it.
0 Kudos
EnTerr
Roku Guru

Re: UDP Broadcast Responses

I don't have 2100 model (XDS) - i have tried 2000, 2050 and 3100 though - every which way, with Linksys and Apple Airport (and other routers - but dont remember if i did Netgear) - and multicasts worked fine. All 2xxx models using same chipset PNX8935, i think they use the very same firmware as well and there should be no difference in behavior.

It's true that Roku's SSDP implementation is limping (search this board for earlier complains) but it does reply to M-SEARCH.... twice even, it does reply (part of the limpness). Are any of the smartphone apps (e.g. in iOS Roku's "Roku", "Remote for Roku" or "DVPRemote") able to auto-discover all your devices? If yes, problem be in your code. If no, do you have another router you can try for testing?
0 Kudos
greubel
Visitor

Re: UDP Broadcast Responses

The Roku remote app for the iPhone works, finds all the devices.

Ok, replaced the Netgear router with a D_Link.
Same problem and symptoms also shuffled all the boxes around.
I would really hate to release an app that would not work on 1/3 of the installed Roku base.
Need some help resolving this.
0 Kudos
EnTerr
Roku Guru

Re: UDP Broadcast Responses

Hmm - since auto-discovery of a remote app worked and change of routers did not help - evidence is mounting that the problem is withing your code.

Try the following Python snippet, check the output:
import socket
sk = socket.socket(socket.AF_INET, socket.SOCK_DGRAM, socket.IPPROTO_UDP)
sk.sendto('M-SEARCH * HTTP/1.1\nMAN:"ssdp:discover"\nST:roku:ecp\n\n', ('239.255.255.250',1900))
while 1: print sk.recvfrom(999)[0]

For your 3 devices typically you will see 6 responses. Use ctrl-c to exit the script.
0 Kudos
greubel
Visitor

Re: UDP Broadcast Responses

Ok, that works. Ran the script on my mac and all the boxes responded.
But that is the same as using the Roku app from my iPhone. It, finds them all.

The Roku broadcast code and replies always works. But my code running at the user level with the SDK only works on a wired connection ???
The same code works fine on the other two boxes for both wired and wireless ???

You would think that it would either work or not, on all the boxes. Need some consistency.
0 Kudos
EnTerr
Roku Guru

Re: UDP Broadcast Responses

"greubel" wrote:
Ok, that works. Ran the script on my mac and all the boxes responded. But that is the same as using the Roku app from my iPhone. It, finds them all.

The Roku broadcast code and replies always works. But my code running at the user level with the SDK only works on a wired connection ???
The same code works fine on the other two boxes for both wired and wireless ???

You would think that it would either work or not, on all the boxes. Need some consistency.

I am missing context here - what do you mean by "app" and "user level with the SDK"? Are you talking iPhone or Android or Roku BS or what?

the snippet i sent works on "user level" - it can't get any user-er than that - on Windows and Mac. i have analogous code working on iPhone, so it's not Apple's SDK either.
0 Kudos