#!/usr/bin/python3 import socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) result = sock.connect_ex(('10.10.130.111',8080)) if 0 == result: print("Port is open") else: print("Port is not open,return code:%s" % result)