什么是永远运行服务器端脚本的方法是什么? [英] What are the ways to run a server side script forever?

查看:101
本文介绍了什么是永远运行服务器端脚本的方法是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要运行如Python永远的服务器端脚本(或尽可能长时间没有松动的状态),这样可以保持的插座开放以及异步反应事件,如接收到的数据。例如,如果我使用扭曲获得套接字通信。

I need to run a server side script like Python "forever" (or as long as possible without loosing state), so they can keep sockets open and asynchronously react to events like data received. For example if I use Twisted for socket communication.


  • 我将如何处理这样的事情?

  • 是我困惑?还是有要实现异步socket通信更好的办法?

  • 通过Apache服务器开始一次脚本后,我怎么阻止它运行?

推荐答案

如果您使用的是扭曲的,然后它用于启动和停止守护进程的整体架构。

If you are using twisted then it has a whole infrastructure for starting and stopping daemons.

http://twistedmatrix.com/projects/core/documentation/howto/ application.html

我将如何处理这样的事情?

How would I manage something like this?

扭曲很适合这一点,阅读上面

Twisted works well for this, read the link above

是我困惑?还是有要实现异步socket通信更好的办法?

Am I confused? or are there are better ways to implement asynchronous socket communication?

Twisted是在异步Socket通信非常好。直到你得到它的窍门,虽然这是很难对大脑!

Twisted is very good at asynchronous socket communications. It is hard on the brain until you get the hang of it though!

通过Apache服务器开始一次脚本后,我该如何阻止它运行?

After starting the script once via Apache server, how do I stop it running?

扭曲的工具假定命令行访问,所以你必须编写启动/停止他们,如果我明白你想要做什么一个cgi包装。

The twisted tools assume command line access, so you'd have to write a cgi wrapper for starting / stopping them if I understand what you want to do.

这篇关于什么是永远运行服务器端脚本的方法是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆