使用OTP原理的非阻塞TCP服务器 [英] Non-blocking TCP server using OTP principles

查看:154
本文介绍了使用OTP原理的非阻塞TCP服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我开始学习Erlang,所以我想写你好,世界!的并发编程,一个IRC机器人。



我已经使用Erlang编写了一个没有任何OTP优点(主管,应用程序等)的行为。我正在使用OTP原理来重写它,但不幸的是,我无法确定使用OTP进行套接字编程的正确方式。



似乎唯一合理的方式是手动创建另一个进程并将其链接到主管,但肯定有人在某个地方已经这样做了。

解决方案

我认为这是你要找的:
http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles
这是一个关于如何使用OTP构建非阻塞TCP服务器的完整教程(当然,已完整记录和解释)。


I'm starting to learn Erlang, so I'm trying to write the "hello, world!" of concurrent programming, an IRC bot.

I've already written one using Erlang without any OTP niceties (supervisor, application, etc. behaviours). I'm looking to rewrite it using OTP principles but unfortunately I can't figure out the "right" way to do socket programming with OTP.

It seems the only reasonable way is to create another process manually and link it to the supervisor, but surely someone, somewhere, has done this before.

解决方案

I think this is what you're looking for: http://www.trapexit.org/Building_a_Non-blocking_TCP_server_using_OTP_principles It's a full tutorial about how to build a non-blocking TCP server using OTP (of course, is fully documented and explained).

这篇关于使用OTP原理的非阻塞TCP服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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