Smpp (3.4) Client Library for Go
SMPP (3.4) Client Library in pure Go.
This library is well tested with SMSC simulators:
go get -u github.com/linxGnu/gosmpp
v0.1.4
, gosmpp is written in event-based style and fully-manage your smpp session, connection, error, rebinding, etc. You only need to implement some hooks: trans, err := gosmpp.NewSession(
gosmpp.TRXConnector(gosmpp.NonTLSDialer, auth),
gosmpp.Settings{
EnquireLink: 5 * time.Second,
ReadTimeout: 10 * time.Second,
OnSubmitError: func(_ pdu.PDU, err error) {
log.Fatal("SubmitPDU error:", err)
},
OnReceivingError: func(err error) {
fmt.Println("Receiving PDU/Network error:", err)
},
OnRebindingError: func(err error) {
fmt.Println("Rebinding but error:", err)
},
OnPDU: handlePDU(),
OnClosed: func(state gosmpp.State) {
fmt.Println(state)
},
}, 5*time.Second)
if err != nil {
log.Println(err)
}
defer func() {
_ = trans.Close()
}()
g++ -std=c++11 example/smsc_simulator/smsc.cpp -o smsc
./smsc &
go run example/main.go
Full example could be found: gist