首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Erlang:对与牧场相关的错误的误解

Erlang:对与牧场相关的错误的误解
EN

Stack Overflow用户
提问于 2013-12-08 13:49:52
回答 1查看 529关注 0票数 0

我正在尝试使此应用程序成为FIX protocol

我使用erl -pa ./ebin -pa ebin ./deps/*/ebin启动Erlang shell。然后运行应用程序,如下所示:application:start(fix)。之后,我像这样调用"start_listener“函数:fix:start_listener()。结果是出现了这个错误:

代码语言:javascript
复制
exception error: no match of right hand side value 
                 {error,
                     {{shutdown,
                          {failed_to_start_child,ranch_acceptors_sup,
                              badarg}},
                      {child,undefined,
                          {ranch_listener_sup,fix_listener},
                          {ranch_listener_sup,start_link,
                              [fix_listener,10,ranch_tcp,
                               [{port,[8501]}],
                               fix_server,[]]},
                          permanent,5000,supervisor,
                          [ranch_listener_sup]}}}
in function  fix:start_listener/0 (src/fix.erl, line 21)

这一切意味着什么?如何纠正这个错误呢?

我的代码是:

代码语言:javascript
复制
`-module(fix).
 -author('Max Lapshin <max@maxidoors.ru>').
 -include("log.hrl").
  % -include("../include/admin.hrl").
 -include("../include/business.hrl").
 -compile(export_all).

  %%  @doc Start acceptor with `ranch' on port, specified in application environment under fix_port%%
  -spec start_listener() -> {ok, pid()}.
   start_listener() ->
   application:start(ranch),
   Spec = ranch:child_spec(fix_listener, 10,
   ranch_tcp, [{port, fix:get_value(fix_port)}],
    fix_server, []
      ),
     {ok, Pid} = supervisor:start_child(fix_sup, Spec),
       error_logger:info_msg("Starting FIX server on port ~p~n",[fix:get_value(fix_port)]),
      {ok, Pid}.

‘这是一段显示错误的代码。

EN

回答 1

Stack Overflow用户

发布于 2013-12-09 03:13:58

这是不正确的:

代码语言:javascript
复制
[{port,[8501]}]

端口值必须是整数。你的fix:get_value函数返回列表8501而不是8501,你会得到这个错误。

票数 4
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20450364

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档