Page 1 of 2

Smpp Dissconnect and re connect

Posted: Fri Jan 17, 2020 11:45 am
by developerlearn999
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 ?

Re: Smpp Dissconnect and re connect

Posted: Fri Jan 17, 2020 12:13 pm
by alt
which error did you get?

Re: Smpp Dissconnect and re connect

Posted: Fri Jan 17, 2020 10:45 pm
by developerlearn999
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

Re: Smpp Dissconnect and re connect

Posted: Sun Jan 19, 2020 10:58 am
by developerlearn999
can you tell me what error to take on the dissconnect event?from which object?

Re: Smpp Dissconnect and re connect

Posted: Mon Jan 20, 2020 8:21 am
by alt
I need entries from internal library logger, at lease for the error level.
https://docs.inetlab.com/smpp/v2/articles/tracing.html

Re: Smpp Dissconnect and re connect

Posted: Mon May 04, 2020 2:32 pm
by zaikay
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.???

Re: Smpp Dissconnect and re connect

Posted: Tue May 05, 2020 8:29 am
by alt
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)

Re: Smpp Dissconnect and re connect

Posted: Tue May 05, 2020 9:54 am
by zaikay
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();
        }

Re: Smpp Dissconnect and re connect

Posted: Tue May 05, 2020 11:36 am
by alt
thank you for the example. I'll check this case.

Re: Smpp Dissconnect and re connect

Posted: Wed May 06, 2020 11:28 am
by alt
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?

Re: Smpp Dissconnect and re connect

Posted: Wed May 06, 2020 2:39 pm
by zaikay
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

Re: Smpp Dissconnect and re connect

Posted: Fri May 08, 2020 12:28 pm
by alt
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.

Re: Smpp Dissconnect and re connect

Posted: Mon May 11, 2020 8:54 am
by zaikay
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.

Re: Smpp Dissconnect and re connect

Posted: Wed May 13, 2020 1:58 pm
by zaikay
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

Re: Smpp Dissconnect and re connect

Posted: Thu May 14, 2020 2:11 pm
by alt
Could you test the version 2.8.1-beta-2021 as well? There are some improvements for connection recovery.