def check_network_connection(server='www.google.com'):
 logger = logging.getLogger(__name__)
 logger.debug("Checking network connection to server '%s'...", server)
 try:
  host = socket.gethostbyname(server)
  socket.create_connection((host, 80), 2)
 except Exception:
  logger.debug('Network connection not working')
  return False
 else:
  logger.debug('Network connection working')
  return True

def check_network_connection ( server = 'www.google.com' ) : logger = logging . getLogger ( __name__ ) logger . debug ( "Checking network connection to server '%s'..." , server ) try : host = socket . gethostbyname ( server ) socket . create_connection ( ( host , 80 ) , 2 ) except Exception : logger . debug ( 'Network connection not working' ) return False else : logger . debug ( 'Network connection working' ) return True
checks if jasper can connect a network server .