[erlang-questions] Tutorial (Erlang / Python)

Walter Weinmann <>
Wed Sep 13 10:49:42 CEST 2017


No problem with:

*ok = application:ensure_started(inets),*

but still:

*** exception error: no match of right hand side value {error,econnrefused}*
*     in function  client:t/0
(d:/SoftDevelopment/Projects/erlang_thrift_tutorial*
*_idea/erlang_thrift_tutorial/_build/default/lib/tutorial/src/client.erl,
line 43*

with:

{ok, Client0} = connect(Port),

respectively:

connect(Port) ->

    ok = application:ensure_started(inets),
    io:format("inets~n", []),
    thrift_client_util:new("localhost", Port, calculator_thrift, []).


Walter

On 13 September 2017 at 09:58, zxq9 <> wrote:

> On 2017年09月13日 水曜日 09:29:45 you wrote:
> > Hi Craig, thanks for the answer.
> >
> > I have a repository in Github
> > <https://github.com/walter-weinmann/erlang_thrift_tutorial> with the
> > complete test environment based on the Erlang and Python examples from
> the
> > Thrift tutorial. Of course, the corresponding program parts were also
> > generated by the Thrift compiler. The Python server is also ok and can be
> > reached via the Python client. The Erlang server can be accessed via both
> > clients (Erlang and Python). Only the connection from the Erlang Client
> to
> > the Python server is not established. Of course, it's the kind of
> > connection I need first.
> >
> > Apache Thrift sounds really good, as it theoretically connects a lot of
> > platforms.
>
> If the Python client can talk to the Python service over the network
> without any problem, the perhaps the generated Erlang code has a runtime
> dependency on inets or something similar.
>
> Try something like this:
>
>     t() ->
>         {ok, Client} = connect(9090),
>         % ... whatever else you were going to do.
>
>
>     connect(Port) ->
>         ok = application:ensure_started(inets),
>         thrift_client_util:new("localhost", Port, calculator_thrift, []).
>
> Also, each time you receive a response from the call/3 function, check if
> the received `Client1,2,3` values are actually the same as the original
> `Client` value returned by `thrift_client_util:connect/4`. Also check if
> there are any additional start or init functions that are supposed to be
> called in thrift_client or thrift_client_util to get things set up (some
> init functions may take care of things like starting dependencies).
>
> -Craig
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170913/7dacba9b/attachment.html>


More information about the erlang-questions mailing list