Usually, most of the windows applications or other apps which reside on client system, needs to internet connectivity to perform some tasks. If the system is not connected to internet, it will take some time to check for it and return an error. For dealing in this kind of situations, here is a code sample that you can directly use with your code to check whether the system is connected to internet or not.