Posted in Python onFebruary 10, 2013
#!/usr/bin/env python # name IsOpen.py import os import socket def IsOpen(ip,port): s = socket.socket(socket.AF_INET,socket.SOCK_STREAM) try: s.connect((ip,int(port))) s.shutdown(2) print '%d is open' % port return True except: print '%d is down' % port return False if __name__ == '__main__': IsOpen('1.1.1.1',800)
python判断端口是否打开的实现代码
声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@