fiorix / go-diameter

Diameter stack and Base Protocol (RFC 6733) for the Go programming language
Other
252 stars 143 forks source link

examples/server and examples/client don't connect #61

Closed dirkm closed 8 years ago

dirkm commented 8 years ago

I tried to run examples/server/server.go and make a test-request using examples/client/client.go.

the server seems to come up:

dirk:~/gopath/src/github.com/fiorix/go-diameter/examples/server$ go run server.go
2016/10/01 09:28:28 Starting diameter server on :3868

In another shell I open the client, but I am unable to connect

dirk:~/gopath/src/github.com/fiorix/go-diameter/examples/client$ go run client.go 
2016/10/01 09:40:50 Use wireshark to see the messages, or try -hello
2016/10/01 09:40:50 no common application
2016/10/01 09:40:52 no common application

Is this expected? I must admit that these are my first steps in go.

The server responds with an error to a simple telnet localhost 3868 as expected. I am using go1.6 on ubuntu 16.4

jaroszan commented 8 years ago

I suggest that you comment out the following line in the client.go:

diam.NewAVP(avp.AcctApplicationID, avp.Mbit, 0, datatype.Unsigned32(4)), // RFC 4006

This example is obsolete since Credit Control application has type "auth" and this line adds application id with type "acct". go-diameter does not support application with id = 4 and type = acct.

There is still an issue with error message here, client is adding application that he does not support. However if you want to send out what is supported by the dictionary it will be fine.

jaroszan commented 8 years ago

You may also want to replace the following line:

<application id="999"> with <application id="999" type="acct"> to make sure that server and client are on the same page.

More strict dictionary verification was introduced a couple of days ago, hence examples aren't up to date.

jaroszan commented 8 years ago

See here for changes that will get examples to work https://github.com/fiorix/go-diameter/pull/62

dirkm commented 8 years ago

Your fix works for me. Thanks for the quick patch!

fiorix commented 8 years ago

Yeah no more hacks, #62 was just merged in. Thanks guys.