fiorix / go-smpp

SMPP 3.4 Protocol for the Go programming language
MIT License
218 stars 135 forks source link

Gracefully stop #89

Closed goten4 closed 4 years ago

goten4 commented 4 years ago

Hello,

Here is my code that initiate the connection to the SMPP server :

var trx *smpp.Transceiver

func Bind() error {
    trx = &smpp.Transceiver{
        Addr:    "localhost:2375",
    }
    conn := trx.Bind()
    if connStatus := <-conn ; connStatus.Status() != smpp.Connected {
        return connStatus.Error()
    }
    return nil
}

func Stop() error {
    return trx.Close()
}

I call the Stop() function when I catch the Interrupt signal. I'd like to send an Ubind command to the SMPP server before closing the connection. Is there a way to do that ? It would be great to have something like that :

func Stop() error {
    return trx.Unbind()
}

Thanks

goten4 commented 4 years ago

So sorry, I've just realized that the client.Close() already do the job !