[erlang-questions] Question about basic use of diameter

Anders Svensson <>
Fri Sep 13 13:02:47 CEST 2013


On Fri, Sep 13, 2013 at 11:46 AM, QDev <> wrote:
>
> Hi - I'm a bit stuck using the diameter application. Do the Origin-Host and Origin-Realm have to reflect the real host and domain name(s) of the machine(s) in question?

The diameter application doesn't care. All that RFC 6733 requires of
Origin-Host is that it be unique within a single host (6.3), while
Origin-Realm is expected to be related to the DNS domain name (6.4,
1.2; could be clearer). Using the physical host/domain is fairly
typical it seems.

> After attempts to write and test a basic relay kept failing, I tried using the server.erl and client.erl from the diameter application's ./examples/code directory and things don't seem to be working properly:
>
> Erlang R16B01 (erts-5.10.2) [source] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false]
>
> Eshell V5.10.2  (abort with ^G)
> 1> diameter:start().
> ok
> 2> server:start().
> ok
> 3> client:start().
> ok
> 4> client:connect().
> ** exception error: undefined function client:connect/0
> 5> client:connect(tcp).
> {ok,#Ref<0.0.0.68>}
> 6> client:call().
> {error,no_connection}

You haven't told the example server to start listening: you need to
call server:listen(tcp) as well. Here's how it should look:

  Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4]
[async-threads:10] [hipe] [kernel-poll:false]

  Eshell V5.10.2  (abort with ^G)
  1> diameter:start().
  ok
  2> server:start().
  ok
  3> server:listen(tcp).
  {ok,#Ref<0.0.0.55>}
  4> client:start().
  ok
  5> client:connect(tcp).
  {ok,#Ref<0.0.0.101>}
  6> up: <0.56.0>
  client:call().
  {ok,{diameter_base_RAA,"client;1440573120;1;",
                         2001,"server.example.com","example.com",[],[],[],[],[],
                         [],[],[],[],[]}}

> I get the same problem if I run the client in a separate shell, but the diameter service *is* up an running:
>
> $ netstat -a | grep diameter
> tcp4       0      0  localhost.diameter     *.*                    LISTEN
>
> Whilst testing my own code, instead of {error, no_connection} I get {error,no_service}} back from `diameter:call(?NAME, ?APP_ALIAS, Req, [])' - can anyone suggest what I might be missing here?

no_connection means that there's no appropriate transport connection,
as determined by diameter and/or your pick_peer callback. no_service
mean that you haven't configured a service (ie.
diameter:start_service/2) with the specified name.

> The tutorial at http://vas.io/blog/2012/05/13/erlang-real-time-server-part-1-diameter-server/ doesn't work for me either - perhaps there is some environment configuration I'm missing?

Haven't seen this one but give the above a try for starters.

/Anders, Erlang/OTP


>
> Q
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions



More information about the erlang-questions mailing list