首页 > 编程 > Python > 正文

python检测服务器端口代码实例

2019-11-25 11:47:52
字体:
来源:转载
供稿:网友

这篇文章主要介绍了python检测服务器端口代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下

import socketsk = 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()

以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持武林网。

发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表