Python-网络管理
作者:互联网
1.python检测远程端口是否打开的方法
import socket
sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sk.settimeout(1)
try:
sk.connect(('www.sharejs.com',80))
print 'Server port 80 OK!'
except Exception:
print 'Server port 80 not connect!'
sk.close()
标签:socket,网络管理,Python,sk,connect,print,80,port 来源: https://www.cnblogs.com/rxysg/p/15747446.html