How do devices like Chromecast get discovered by other devices without connecting to the same local network. I am aware of protocols like ssdp, dial, and mdns, but all of those protocols require you to be connected to the same local network.
For example, when you plug in a chromecast and begin the initial setup, you somehow connect to that chromecast using another device (mac, android, iphone). Once you connect to that chromecast, then you start filling out wifi credentials so you can connect the chromecast to the network. Once that chromecast connects to the wifi, you can easily use any of the protocols above.
So my question is, how do you connect to the chromecast with another device, without the chromecast knowing the local network?
When you first connect a Chromecast, it sets up a temorary WiFi access point. The Chromecast Setup application (whether on Windows, Mac, or Android) looks for that SSID and connects to it automatically (whether you realize it or not--- look at your wifi ssid and you will see it change). Once you enter the credentials for your wifi connection, the Chromecast then connects to your wifi network and turns off it's inbuilt wifi network.
Your laptop/device is then connected back to your original wifi network and the Chromecast will also be connected to your network. As a result, it is available as a DLNA device and available to see other network devices.