I am trying to implement my own UpNP scan, it is mostly working, and to prove that it's not me I have a windows program that allows you to send packets and see what response comes back.
I am sending a packet to 239.255.255.250
on port 1900
and I am sending the following data:
M-SEARCH * HTTP/1.1
Host: 239.255.255.250:1900
Man: "ssdp:discover"
MX: 10
ST: ssdp:all
Just for further info, in my Java code (Android) I have the following but I get the same response as the packet tester application:
try
{
byte[] sendData = new byte[1024];
//byte[] receiveData = new byte[1024];
byte[] receiveData;
String mSearch = "M-SEARCH * HTTP/1.1\r\nHost: 239.255.255.250:1900\r\nMan: \"ssdp:discover\"\r\nMX: 10\r\nST: ssdp:all\r\n\r\n";
sendData = mSearch.getBytes();
DatagramPacket sendPacket = new DatagramPacket(sendData, sendData.length, InetAddress.getByName("239.255.255.250"), 1900);
DatagramSocket clientSocket = new DatagramSocket();
clientSocket.send(sendPacket);
while (keepGoing)
{
receiveData = new byte[1024];
receivePacket = new DatagramPacket(receiveData, receiveData.length);
clientSocket.receive(receivePacket);
String response = new String(receivePacket.getData());
if (response == null || response.length() == 0)
{
keepGoing = false;
}
else
{
iupnpScan.updateText(response);
}
}
iupnpScan.complete(true);
return true;
}
catch (UnknownHostException ex)
{
Log.e("MainActivity", "Unknown Host Exception: " + ex.toString());
}
catch (SocketException ex)
{
Log.e("MainActivity", "Socket Exception: " + ex.toString());
}
catch (IOException ex)
{
Log.e("MainActivity", "IO Exception: " + ex.toString());
}
iupnpScan.complete(false);
return false;
I am getting some devices come back, such as my smart TV, router and NAS but the Philips Hue bridge is never returned in the reply.
Does the Philips Hue Bridge implement UpNP differently? All I can see is what response they send back now anything about what is needed to find it.