req = ['M-SEARCH * HTTP/1.1',
'HOST: 239.255.255.250:1900',
'MAN: "ssdp:discover"',
'ST: ssdp:all',
'MX: 3',
"", ""]
req = '\r\n'.join(req)
sock = socket(AF_INET, SOCK_DGRAM)
[sock.sendto(req, ('239.255.255.250',1900)) for i in range(3)]
resp, (addr,port) = sock.recvfrom(1024)
the SSDP discovery request i perform with this code retrieves me only the rootdevice instead of all the LAN connected devices (samsung tv, sky+hd box, laptop, PCs).
does anyone know how to display all the devices?
You only wait for one answer so it seems logical that you only get one :) This should show all of them (including the duplicates that the devices/services send).
while (True):
resp, (addr,port) = sock.recvfrom(1024)
print resp