"LCubed" wrote:
So I made some changes, without any good results. I set the TTL in the MulticastSocket to 6. I also changed the datagram packet to:
M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
Content-Length: 0
Man: "ssdp:discover"
MX: 6
ST: roku:ecp
A carriage return, line-feed follow each line with an additional set at the end of the string.
I don't think you need the Content-Length in there. Apart from that, it looks like a valid M-SEARCH request.
I encountered similar problems. In my case, sometimes the SSDP discovery worked, sometimes it didn't, sometimes it would only detect one Roku on the network when there were really two. This happened whether from the code running on my laptop or from the Roku IOS app. I assumed there was some router weirdness going on, but never got to the bottom of it. I changed my code to issue multiple M-SEARCH requests; usually between all the requests that would detect all the Rokus. I also did a scan of all the devices on the subnet to check which ones were Rokus. That worked 100% of the time even if the SSDP requests failed.