3

What is enquireLinkTimer property in SMPPSession class from JSMPP library? It rebings session every N milliseconds? If not, is there a way to automatically rebing session with some time interval?

Or what should I do, if I face the following problem: when for a long time there're no messages to send, I think session dies (I got java.net.SocketException: Socket closed ) and then messages don't send.

another-programmer
  • 790
  • 10
  • 34

1 Answers1

3

The enquireLinkTimer keeps your connection to SMSC alive by sending keep-alive-messages to it. But it cannot rebring/reconnect a broken connection.

Maybe the SMSC decides after a while to close the connection because you didn't send SMS for a while. You have to reconnect manually by discarding your old session and creating a new one.

If you want to reconnect immediately you can set up a state Change Listener to your session:

yourSession.addSessionStateListener(new SessionStateListener() {
    @Override
    public void onStateChange(SessionState newState, SessionState oldState,
                                          Object source)
    {
        if (newState == SessionState.CLOSED) {
            /* throw away old session and create a new one */
        }
    }
}
nabinca
  • 1,962
  • 1
  • 15
  • 27