added check to see if real device is attached to use IPv4 connection and use IPv6 for simulator.