Smpp Dissconnect and re connect

developerlearn999
Posts: 85
Joined: Thu Jun 20, 2019 9:34 am

Smpp Dissconnect and re connect

Post by developerlearn999 » Fri Jan 17, 2020 11:45 am

Hi, i get sometimes dissconnection, and i did a reconnect after 10- 20 seconds.
my project run's on a windows service, and i see that it tried to reconnect over and over and fail's.
only when i restart the service the connection is bind with no issues.
any recommandations ?
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Smpp Dissconnect and re connect

Post by alt » Fri Jan 17, 2020 12:13 pm

which error did you get?
developerlearn999
Posts: 85
Joined: Thu Jun 20, 2019 9:34 am

Re: Smpp Dissconnect and re connect

Post by developerlearn999 » Fri Jan 17, 2020 10:45 pm

i see in the log that it got dissconnected and from that point every recoonection fails,
i will see what i can add to the log to catch this next time
developerlearn999
Posts: 85
Joined: Thu Jun 20, 2019 9:34 am

Re: Smpp Dissconnect and re connect

Post by developerlearn999 » Sun Jan 19, 2020 10:58 am

can you tell me what error to take on the dissconnect event?from which object?
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Smpp Dissconnect and re connect

Post by alt » Mon Jan 20, 2020 8:21 am

I need entries from internal library logger, at lease for the error level.
https://docs.inetlab.com/smpp/v2/articles/tracing.html
zaikay
Posts: 9
Joined: Mon May 04, 2020 1:51 pm

Re: Smpp Dissconnect and re connect

Post by zaikay » Mon May 04, 2020 2:32 pm

alt wrote:
Mon Jan 20, 2020 8:21 am
I need entries from internal library logger, at lease for the error level.
https://docs.inetlab.com/smpp/v2/articles/tracing.html
I'm testing a similar behavior using the demo version of your server
Actual client - from pump 2.8.0, server from the Inetlab.SMPP site SmppServer Demo 2.0.0.0 version for net
1) start the server
2) create SmppClient (as a singleton) with the flag ConnectionRecovery = true,
3) initiate the connection according to your examples

if (await client.ConnectAsync("localhost", 7777))
{
Console.WriteLine("Connected to SMPP server");

BindResp bindResp = await client.BindAsync("login", "password", ConnectionMode.Transceiver);

if (bindResp.Header.Status == CommandStatus.ESME_ROK)
{
Console.WriteLine("Bound with SMPP server");
}
}
4) I call SubmitAsync for the 1st time
var responses = await _client.SubmitAsync(
SMS.ForSubmit()
.Text(text)
.From("1111")
.To("79171234567")
.Coding(DataCodings.UCS2)
.DeliveryReceipt()
);
if (responses.Any(a => a.Client == null))
{
throw new SmppConnectionException("Is lost connect");
}

4) restart the server
5) I call the 2nd time SubmitAsync
6) connection restored - all messages reached the server
-----------------
this is like an ideal situation, but in life everything is different, so I send a lot of messages from different flows
at this time I restart the server
as a result, the connection is not restored how much do not wait

sometimes such an error arrives
04.05.2020 16:46:02:ERROR: 80: (SmppClient42.Socket) Connection failed. Unexpected error. Exception: System.TimeoutException: The operation has timed out.
at Inetlab.SMPP.Common.TaskExtensions.TimeoutAfter(Task task, TimeSpan timeout)
at Inetlab.SMPP.Common.SmppSocket.???
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Smpp Dissconnect and re connect

Post by alt » Tue May 05, 2020 8:29 am

What version of the .NET Framework your application targets?
zaikay wrote:
Mon May 04, 2020 2:32 pm
sometimes such an error arrives
04.05.2020 16:46:02:ERROR: 80: (SmppClient42.Socket) Connection failed. Unexpected error. Exception: System.TimeoutException: The operation has timed out.
at Inetlab.SMPP.Common.TaskExtensions.TimeoutAfter(Task task, TimeSpan timeout)
at Inetlab.SMPP.Common.SmppSocket.???
Do you see following log message after this error?

Code: Select all

WARN: Connection failed. Repeat in 120 seconds.
zaikay wrote:
Mon May 04, 2020 2:32 pm
if (responses.Any(a => a.Client == null))
{
throw new SmppConnectionException("Is lost connect");
}
By the way, it is not correct way to check disconnection during submission. You need to check response status:

Code: Select all

response.Any(r=>r.Header.Status == CommandStatus.SMPPCLIENT_NOCONN)
zaikay
Posts: 9
Joined: Mon May 04, 2020 1:51 pm

Re: Smpp Dissconnect and re connect

Post by zaikay » Tue May 05, 2020 9:54 am

What version of the .NET Framework your application targets?
client use .Net Core 3.1
Do you see following log message after this error?

Code: Select all

WARN: Connection failed. Repeat in 120 seconds.
it is not always visible
By the way, it is not correct way to check disconnection during submission. You need to check response status:

Code: Select all

response.Any(r=>r.Header.Status == CommandStatus.SMPPCLIENT_NOCONN)
ok thanks, but that doesn't matter

example
https://www.dropbox.com/s/5nq1wc0x3w3d5 ... le.7z?dl=0

Code: Select all

        static async Task Main(string[] args)
        {
            LogManager.SetLoggerFactory(new ConsoleLogFactory(LogLevel.Error));
            Enumerable.Range(1, 10000).AsParallel().ForAll(async i => await SmsSenderSingelton.SendMessageAsync($"message #{i}"));
            Console.ReadKey();
        }
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Smpp Dissconnect and re connect

Post by alt » Tue May 05, 2020 11:36 am

thank you for the example. I'll check this case.
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Smpp Dissconnect and re connect

Post by alt » Wed May 06, 2020 11:28 am

Hi zaikay,

What do you want to achieve when you do call like:

Code: Select all

  Enumerable.Range(1, 10000).AsParallel().ForAll(async i => await SmsSenderSingelton.SendMessageAsync($"message #{i}"));
Is it only batch sending of the 10000 messages? Or is it stress test for the ThreadPool?
zaikay
Posts: 9
Joined: Mon May 04, 2020 1:51 pm

Re: Smpp Dissconnect and re connect

Post by zaikay » Wed May 06, 2020 2:39 pm

alt wrote:
Wed May 06, 2020 11:28 am
Hi zaikay,

What do you want to achieve when you do call like:

Code: Select all

  Enumerable.Range(1, 10000).AsParallel().ForAll(async i => await SmsSenderSingelton.SendMessageAsync($"message #{i}"));
Is it only batch sending of the 10000 messages? Or is it stress test for the ThreadPool?
I need to use one client for the REST API service, so I test the stability of batch sending from different threads
because notifications of receipt arrive only at the first client
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Smpp Dissconnect and re connect

Post by alt » Fri May 08, 2020 12:28 pm

I have published pre-release version 2.8.1-beta-2015.
You can download it from your Inetlab Account or as NuGet package.

Please test it.
zaikay
Posts: 9
Joined: Mon May 04, 2020 1:51 pm

Re: Smpp Dissconnect and re connect

Post by zaikay » Mon May 11, 2020 8:54 am

alt wrote:
Fri May 08, 2020 12:28 pm
I have published pre-release version 2.8.1-beta-2015.
You can download it from your Inetlab Account or as NuGet package.

Please test it.
Hi, thanks! In the nuggets I saw a new version, I'm going to try tomorrow.
zaikay
Posts: 9
Joined: Mon May 04, 2020 1:51 pm

Re: Smpp Dissconnect and re connect

Post by zaikay » Wed May 13, 2020 1:58 pm

alt wrote:
Fri May 08, 2020 12:28 pm
I have published pre-release version 2.8.1-beta-2015.
You can download it from your Inetlab Account or as NuGet package.

Please test it.
The first time did not work.
Steps:
1) SMPP server did not reboot
2) Recompiled client with new beta
3) Connection recovery does not work
4) Restarting the SMPP server
5) Connection recovery now works
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Smpp Dissconnect and re connect

Post by alt » Thu May 14, 2020 2:11 pm

Could you test the version 2.8.1-beta-2021 as well? There are some improvements for connection recovery.
Post Reply