The reason for this is the Universal Plug and Play (UPnP). UPnP performs a range of operations, but simply put it is the functionality which allows the different devices in a network to discover each other and to connect both within the local network and to the world outside.