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
import socket
HOST = "localhost"
PORT = 443
# Creates a new socket
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
# Try to connect to the given host and port
if sock.connect_ex((HOST, PORT)) == 0:
print("Port " + str(PORT) + " is open") # Connected successfully
else:
print("Port " + str(PORT) + " is closed") # Failed to connect because port is in use (or bad host)
# Close the connection
sock.close()
The text was updated successfully, but these errors were encountered:
here's how:
The text was updated successfully, but these errors were encountered: