Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to detect dropped TCP/SMPP connection #31

Closed
qosimmax opened this issue Jul 29, 2020 · 9 comments
Closed

How to detect dropped TCP/SMPP connection #31

qosimmax opened this issue Jul 29, 2020 · 9 comments

Comments

@qosimmax
Copy link

Hi @linxGnu
When sending sms periodically (every 10 seconds) , then i turned off internet connection(wi-fi).
There is no error when send sms. How detect it?

@linxGnu
Copy link
Owner

linxGnu commented Jul 29, 2020

Hello @qosimmax , please kindly take a look at following test/sample code: https://github.com/linxGnu/gosmpp/blob/master/transceiver_test.go#L53-L73

  • You could detect submit failure or you could be notified when connection is closed
  • gosmpp will try to rebind connection whenever it could and won't tell you about connection fail. But as I mentioned above, you could detect submit failure via https://github.com/linxGnu/gosmpp/blob/master/transceiver_test.go#L56, it's your own callback to handle submit failure.

@qosimmax
Copy link
Author

Yes i am using callback handler OnSubmitError , but this handler not working when i turned off internet.

@linxGnu
Copy link
Owner

linxGnu commented Jul 29, 2020

@qosimmax Oh it's weird, let me take a look later and tell you asap 🤔

@linxGnu
Copy link
Owner

linxGnu commented Jul 30, 2020

@qosimmax
I reran example at: https://github.com/linxGnu/gosmpp/tree/master/example

SMPP Client:

go run main.go

SMSC (at https://github.com/linxGnu/gosmpp/tree/master/example/smsc):

# compile and run smsc
sh run.sh

Sometime turn on/off SMSC, I saw following error raised from smpp client:

dial tcp 127.0.0.1:2775: connect: connection refused
Transmitter is closing. Can not send PDU to SMSC
Transmitter is closing. Can not send PDU to SMSC

In short:

  • SubmitError callbacked when you submit to SMSC but fail. I think in your case, SubmitSM success before turn off internet
  • You could check RebindingError callback. Since smpp client retry connect to SMSC automatically, when you turn off internet, it tries to rebind but failure.

Could you please check it again, maybe using RebindingError callback as the example

@qosimmax
Copy link
Author

qosimmax commented Jul 30, 2020

@linxGnu you run SMSC in the localhost.
When run smpp client and SMSC in same host (localhost) its works fine, problem is when connect to remote SMSC host.
Can you test smmp client with remote host(SMSC simulator) ?
https://melroselabs.com/services/smsc-simulator/

@linxGnu
Copy link
Owner

linxGnu commented Jul 31, 2020

@qosimmax I could reproduce your concern and provide an update. Please kindly check the fix again with latest rc release.

tl;dr: it's go problem of detecting conn broken without specifying read/write deadline.

Thank you very much for using gosmpp and tell us your concern/issue.

@qosimmax
Copy link
Author

qosimmax commented Jul 31, 2020

thanks very much @linxGnu.
If i'm not mistaken value of ReadTimeout must greater than EnquireLinkIntervalMinimum (20 second).

EnquireLinkIntervalMinimum = 20 * time.Second

otherwise EnquireLinkResp handle not working.

@linxGnu
Copy link
Owner

linxGnu commented Jul 31, 2020

@qosimmax Actually, we can't tell when EnquireLinkResp is returned from SMSC. Therefore, I don't think there is a mandatory condition like ReadTimeout >= EnquireLinkInterval.

So, I think I would like to give the choice to user. User should try with their own production environment

@linxGnu
Copy link
Owner

linxGnu commented Aug 6, 2020

I will close this issue. Thank you very much for your concern @qosimmax

@linxGnu linxGnu closed this as completed Aug 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants