[erlang-questions] Tutorial (Erlang / Python)

zxq9 <>
Wed Sep 13 09:58:07 CEST 2017

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).


More information about the erlang-questions mailing list