setting up network detection