I have a Roku device on my network and I want to be able to discover it programically. The official Roku documentation says:
There is a standard SSDP multicast address and port (239.255.255.250:1900) that is used for local network communication. The Roku responds to M-SEARCH queries on this ip address and port.
In order to query for the roku ip address, your program can send the following request using the http protocol to 239.255.255.250 port 1900:
They provide an example using netcat and they say that wireshark can be used to find the result. They also say:
The External Control Protocol enables the Roku to be controlled via the network. The External Control Service is discoverable via SSDP (Simple Service Discovery Protocol). The service is a simple RESTful API that can be accessed by programs in virtually any programming environment.
I have a java program that controls my Roku given its IP Address, and I would like to implement a function that discovers it on the network using this SSDP.
How do I send an M-SEARCH query with java? I have absolutely no conception of how to do this. Is it like an get/post request? If somebody could point me in the right direction I would be very grateful!