client.SubmitAsync vs client.Submit

.NET library for SMPP protocol
Locked
ali513
Posts: 7
Joined: Sun Nov 22, 2015 12:16 pm

client.SubmitAsync vs client.Submit

Post by ali513 » Sun Nov 22, 2015 12:23 pm

Dears,

I am using client.Submit to submit my msgs with single part only and client.Submit for multipart msgs ...

however the performance of client.Submit is very low compared with client.SubmitAsync


is there any way to increase it ?

can i use client.SubmitAsync to send multiparts ?
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: client.SubmitAsync vs client.Submit

Post by alt » Sun Nov 22, 2015 6:12 pm

Hello ali513,

Submit method sends PDU, waits for response and returns it to the application.
SubmitAsync also sends PDU asynchronously. Response you can receive only with the event evSubmitComplete.
Yes, you can use SubmitAsync to send multiparts. In this case event handler of the event evSubmitComplete will be executed several times.

Regards,
Alexey
ali513
Posts: 7
Joined: Sun Nov 22, 2015 12:16 pm

Re: client.SubmitAsync vs client.Submit

Post by ali513 » Mon Nov 23, 2015 7:24 am

Thanks for reply ,,

but sometimes when i used this service i got the response as :

[Reference: 1, Total: 2, Sequence: 2]
[Reference:1 , Total: 2, Sequence: 2]



both parts has same sequence !! .. any idea ? is the problem from smpp server demo app ?

my send code is

Code: Select all

 ISubmitSmBuilder builder = SMS.ForSubmit().Text(message.MessageData).To(message.DestinationAddress).From(message.SourceAddress).Coding(Utils.ParseDataCodings(message.DataCoding)).DeliveryReceipt().Set(delegate(SubmitSm sm)
                        {
                            sm.Sequence = squenceNumber;
                            sm.RegisteredDelivery = (byte)shouldRequestDLr;
                        });

                     
 
                        this.client.SubmitAsync(builder);
ali513
Posts: 7
Joined: Sun Nov 22, 2015 12:16 pm

Re: client.SubmitAsync vs client.Submit

Post by ali513 » Mon Nov 23, 2015 7:47 am

and here is the smpp server log :

10:43:59: DEBUG: 7: (SmppServerClient) Sending PDU: SubmitSmResp, Length: 16, Status: ESME_ROK, Sequence: 1, MessageId: c8b06f21-b717-4401-b021-e19277e541fa
10:43:59: TRACE: 7: (hRsPwpE8SrLKTVd6UY) Socket #6044116: Sending data: 0000003580000004000000000000000163386230366632312d623731372d343430312d623032312d65313932373765353431666100
10:43:59: DEBUG: 7: (SmppServerClient) Sending PDU: SubmitSmResp, Length: 16, Status: ESME_ROK, Sequence: 1, MessageId: bd383e3a-a3fa-488d-aaac-f3d1d4903e1b
10:43:59: TRACE: 7: (hRsPwpE8SrLKTVd6UY) Socket #6044116: Sending data: 0000003580000004000000000000000162643338336533612d613366612d343838642d616161632d66336431643439303365316200
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: client.SubmitAsync vs client.Submit

Post by alt » Sat Nov 28, 2015 4:19 pm

You should assign different sequenceNumber for each SubmitSm PDU. Sending two SubmitSm with the same sequence_number during one SMPP session (between Bind and Unbind)
is violating SMPP protocol.
ali513
Posts: 7
Joined: Sun Nov 22, 2015 12:16 pm

Re: client.SubmitAsync vs client.Submit

Post by ali513 » Sun Dec 06, 2015 5:27 am

already assign ... however if i send a msg with 2 parts ..

the 2 parts will have same sequence
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: client.SubmitAsync vs client.Submit

Post by alt » Tue Dec 08, 2015 8:57 pm

you should fix it. each concatenated PDU must have its own sequence number.
ali513
Posts: 7
Joined: Sun Nov 22, 2015 12:16 pm

Re: client.SubmitAsync vs client.Submit

Post by ali513 » Fri Dec 11, 2015 1:48 pm

how can we do this

because i used ISubmitSmBuilder code:

==============
ISubmitSmBuilder builder = SMS.ForSubmit().Text(message.MessageData).To(message.DestinationAddress).From(message.SourceAddress).Coding(Utils.ParseDataCodings(message.DataCoding)).DeliveryReceipt().Set(delegate(SubmitSm sm)
{
sm.Sequence = squenceNumber;
sm.RegisteredDelivery = (byte)shouldRequestDLr;
});
=========

do /I need to silt the message manually ?
ashish
Posts: 9
Joined: Wed Dec 09, 2015 9:29 am

Re: client.SubmitAsync vs client.Submit

Post by ashish » Mon Dec 14, 2015 9:04 am

how can i manage database in Async method

when i use sequence number then problem Getting in multy part message

how can i manage please suggest me
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: client.SubmitAsync vs client.Submit

Post by alt » Mon Dec 14, 2015 5:54 pm

Don't generate Sequence numbers your self. Let library to do it.

Code: Select all

IList<SubmitSm> list = Inetlab.SMPP.SMS.ForSubmit()
          .Text(message.message)
          .From(message.sender)
          .To(message.number)
          .ExpireIn(TimeSpan.FromHours(message.expiry))
          .DeliveryReceipt()
          .Create(_client);

            foreach (SubmitSm sm in list)
            {
                sm.Sequence = _client.SequenceGenerator.NextSequenceNumber();
                SaveSequenceToDatabase(message.Id, sm.Sequence, smppSessionId);
            }

           _client.SubmitAsync(list);




smppSessionId is any global unique id that should be recreated for a SmppClient on every bind to SMSC. It avoids a problem with duplicated sequence numbers when you need to find message.Id by sequence_number in your database in evSubmitComplete event handler.
Locked