You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
importsocketimportsystry:
soc=socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print("Created socket")
exceptsocket.erroraserror:
print("socket creation failed with error {}".format(error))
port=80# default port for sockettry:
host_ip=socket.gethostbyname('www.github.com')
exceptsocket.gaierror:
print("there was an error resolving the host")
sys.exit()
# connecting to the serversoc.connect((host_ip, port))
print("socket successfully connected to github on port == {}".format(host_ip))