Use flask to test whether the port is open in the firewall

Use flask to test whether the port is open in the firewall Use flask to test whether the port is open in the firewall With F L A S K measured a lower end opening in the anti- fire wall is no open discharge of asking questions

#coding: utf8    

# 从flask框架中导入Flask类
from flask import Flask

# 传入__name__初始化一个Flask实例
app = Flask(__name__)

# app.route装饰器映射URL和执行的函数。这个设置将根URL映射到了hello_world函数上
@app.route('/')
def hello_world():
    return 'Hello World!'

if __name__ == '__main__':
    # 运行本项目,host=0.0.0.0可以让其他电脑也能访问到该网站,port指定访问的端口。默认的host是127.0.0.1,port为5000
    app.run(host='0.0.0.0',port=9000)

vim flask_test_socket.py
python flask_test_socket.py 

Insert picture description here
Insert picture description here

Guess you like

Origin blog.csdn.net/qq_41375318/article/details/115048118