import socket sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sk.settimeout(10) try: sk.connect(('127.0.0.1',80)) print('Server port 80 OK!') except Exception: print('Server port 80 not connect!') sk.close()
import socket sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) sk.settimeout(10) try: sk.connect(('127.0.0.1',80)) print('Server port 80 OK!') except Exception: print('Server port 80 not connect!') sk.close()