Erlang:如何嵌入inet:httpd?
将 inets:httpd
模块嵌入现有应用程序的正确方法是什么?
我想要一个实现此目标的示例/指南。
更新:我希望能够从现有应用程序中动态启动 inets:httpd
服务。我不想要一个利用启动脚本的解决方案,因为使用此方法不允许动态指定端口
。
What is the proper way to embed the inets:httpd
module inside an existing application?
I would like an example / guidelines to achieving this, please.
Updated: I want to be able to start an inets:httpd
service dynamically from within an existing application. I do not want a solution which leverages a boot script as using this method doesn't allow to specify a port
dynamically.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
发布工具将允许您组合一个完整的独立版本,包括所有相关应用程序。如果这就是您所说的嵌入的意思,那么我将从这里开始。它用于创建用于嵌入式系统的 erlang 应用程序。
http://www.erlang.org/doc/design_principles/release_struct.html# id2272165对此有概述。
更新
看到你的更新后。那么您需要做的就是:
在您的应用程序中的某个位置。请记住,执行此操作时,服务不会由 inets 应用程序接管和故障转移处理,但可以通过软代码重新加载。您将负责自行处理此事。如果您不介意失去该功能,那么这应该可以正常工作。
The release tools will allow you to put together a complete standalone release including all dependent applications. If that is what you meant by embed then I would start there. It's used for creating erlang applications meant for embededed systems.
http://www.erlang.org/doc/design_principles/release_structure.html#id2272165 has an overview of this.
Update
After seeing your update. Then all you need to do is:
somewhere in your application. Keep in mind that when you do this the service will not be handled by inets application takeover and failover but can be soft-code reloaded. You will be responsible for handling this yourself. If you don't mind losing that functionality then this should work just fine.