Discovery via UPnP

Ha yes …
Strange the scan need to work in local mode. I don’t understand how this code need to work.
But I think you can find this kind of code on google, was just the first result I have found. And yes It need to work offline

Edit:
After some search on the net it seem the adress 239.255.255.250 is an adress that can work offline.

(Google translate)

your computer is contacting 239.255.255.250 (IANA server group, important name resolution servers on the Internet) via port 1900 using Simple Service Discovery Protocol (SSDP) to locate all machines" → Definition IANA: The IANA allocates IP addresses and AS number blocks to RIRs

And the address 239.255.255.250 is a multicast @IP not routed on the Internet and reserved for the SSDP protocol. Clearly, if you launch a ping on this IP, the machine that will answer you will be a machine on your local network and nothing else.