Skip to content

Instantly share code, notes, and snippets.

View kitusmark's full-sized avatar

Marc kitusmark

View GitHub Profile
@kitusmark
kitusmark / haveInternet.py
Created December 15, 2015 17:09 — forked from rayansostenes/haveInternet.py
A python method to check if the system have a active connection to the internet
import socket
def haveInternet():
REMOTE_SERVER = "www.google.com"
try:
host = socket.gethostbyname(REMOTE_SERVER)
s = socket.create_connection((host, 443))
return True
except: