Check internet connection before using it.