我正在尝试使此应用程序成为FIX protocol
我使用erl -pa ./ebin -pa ebin ./deps/*/ebin启动Erlang shell。然后运行应用程序,如下所示:application:start(fix)。之后,我像这样调用"start_listener“函数:fix:start_listener()。结果是出现了这个错误:
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)这一切意味着什么?如何纠正这个错误呢?
我的代码是:
`-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}.‘这是一段显示错误的代码。
发布于 2013-12-09 03:13:58
这是不正确的:
[{port,[8501]}]端口值必须是整数。你的fix:get_value函数返回列表8501而不是8501,你会得到这个错误。
https://stackoverflow.com/questions/20450364
复制相似问题