eventlet.backdoor 的使用
2014-01-02 16:11
316 查看
版权声明:本文为博主原创文章,遵循 CC 4.0 by-sa 版权协议,转载请附上原文出处链接和本声明。
本文链接:https://blog.csdn.net/ssdxiao/article/details/17759149
eventlet 提供了一种查看程序运行,debug的方式,称为backdoor 他是在每个程序的后台执行了一个telnet的服务器。这样可以远程登录来查看程序的运行状态。
import threading import time import eventlet from eventlet import backdoor eventlet.monkey_patch() global should_printing should_printing = True def turn_off_printing(): global should_printing should_printing = not should_printing def printing_function(): global should_printing n = 0 while True : if should_printing == True: print "printing",n n = n+1 time.sleep(1) def _dont_use_this(): print("Don't use this, just disconnect instead") if __name__ == '__main__': backdoor_locals = {'exit': _dont_use_this, 'quit': _dont_use_this, 'off':turn_off_printing, } eventlet.spawn(backdoor.backdoor_server, eventlet.listen(('localhost', 3000)), locals=backdoor_locals) thread = threading.Thread(target=printing_function) thread.start() while(1): time.sleep(1)
eventlet 提供了一种查看程序运行,debug的方式,称为backdoor 他是在每个程序的后台执行了一个telnet的服务器。这样可以远程登录来查看程序的运行状态。
相关文章推荐
- Python——eventlet.backdoor
- event 使用
- Android屏幕旋转使用OrientationEventListener的监听
- C#使用keybd_Event----键盘虚拟键值编码表
- keybd_event使用方法
- MVVM-Sidekick 之SendToEventRouterAction使用
- Android之EventBus1.0 和EventBus3.0的使用详解
- 事件CEvent的使用
- 详解python多线程、锁、event事件机制的简单使用
- #730 – 使用QueryContinueDrag 事件(Use QueryContinueDrag Event to Know When Mouse Button State Changes)
- ie与firefox下的event使用说明与详细区别
- Android事件传递之onInterceptTouchEvent()和requestDisallowInterceptTouchEvent()方法的使用
- Android消息传递之EventBus 3.0使用与案例
- jquery中使用event.target的几点
- 演示事件(Event)怎样使用以及怎样为用户控件添加一个事件(示例代码下载)
- eventlet.wsgi 中的 start_response定义
- Android之EventBus使用详解
- EventBus深入浅析之基本使用
- sqlalchemy触发器的使用-Event
- [转]System.ArgumentException: 回发或回调参数无效。在配置中使用 < pages enableEventValidation="true"/> 或在页面中使用 <% @ Page EnableEventValidation="true" %> 启用了事件验证