How to enable SendSpeedLimit in SmppServer

.NET library for SMPP protocol
Post Reply
murtz
Posts: 15
Joined: Thu May 14, 2015 11:04 am

How to enable SendSpeedLimit in SmppServer

Post by murtz » Tue Apr 11, 2017 8:16 am

Hi,

I'm writing a SmppReceiver app using the SmppServer class where multiple clients will connect to this server with 1 or more binds. I want to limit the number of messages that they can submit to my server per bind. How can I achieve this?

I know of a property 'SendSpeedLimit' in SmppClient class which limits number of messages sent to the server. Is there a similar property available within SmppServer class that can be assigned to each connected client?
alt
Site Admin
Posts: 742
Joined: Tue Apr 25, 2006 9:45 am

Re: How to enable SendSpeedLimit in SmppServer

Post by alt » Wed Apr 19, 2017 9:29 pm

Hi murtz,

SendSpeedLimit is not yet supported in SmppServerClient class.

How do you see SmppServer should handle over limit?
murtz
Posts: 15
Joined: Thu May 14, 2015 11:04 am

Re: How to enable SendSpeedLimit in SmppServer

Post by murtz » Thu May 18, 2017 5:44 am

Hi alt,

How about implementing the same logic that is there within SmppClient?

On exceeding this limit, the server can return THROTTLING_ERROR.
alt
Site Admin
Posts: 742
Joined: Tue Apr 25, 2006 9:45 am

Re: How to enable SendSpeedLimit in SmppServer

Post by alt » Fri May 19, 2017 12:10 pm

This logic has been added in release 1.2.
Please check ChangeLog
murtz
Posts: 15
Joined: Thu May 14, 2015 11:04 am

Re: How to enable SendSpeedLimit in SmppServer

Post by murtz » Tue May 30, 2017 7:56 am

Hi,
I believe there is a problem in ReceiveSpeedLimit property.
I have checked the source code and can see that the stopwatch is reset every time it is being accessed. This results in returning ESME_RTHROTTLED for every communication, even for Bind event.
Also, I do not know why would you need to check this limit in case of Bind.
alt
Site Admin
Posts: 742
Joined: Tue Apr 25, 2006 9:45 am

Re: How to enable SendSpeedLimit in SmppServer

Post by alt » Wed May 31, 2017 3:13 pm

You are right, there is no sense to check limit for Bind.
I'll fix it in the next version.
murtz
Posts: 15
Joined: Thu May 14, 2015 11:04 am

Re: How to enable SendSpeedLimit in SmppServer

Post by murtz » Thu Jun 01, 2017 7:59 am

Do check your rate limiting logic also. The problem I see in your code for both SendSpeedLimit and ReceiveSpeedLimit is that you're restricting PDUs from sending/receiving during a given time based on the gap between that PDU and the last PDU sent/received.
This shouldn't be always true. Take below scenario for example,

- I set the SendSpeedLimit to 5 SMS/sec.
- I try to send 5 SMS at exactly the same time.
- The current logic will keep a gap of 200ms between each PDU submission which is not necessary. It should allow to send all 5 PDUs at the same time but if the 6th PDU comes during the same second, then only it should wait for that timespan to complete before submitting the next PDU.

The same goes for ReceiveSpeedLimit.

You can look into this for a good alternative for RateLimitting. http://www.jackleitch.net/2010/10/bette ... h-dot-net/

Let me know your thoughts

Thanks
alt
Site Admin
Posts: 742
Joined: Tue Apr 25, 2006 9:45 am

Re: How to enable SendSpeedLimit in SmppServer

Post by alt » Thu Jun 01, 2017 9:00 am

thank you for suggestion.

I think it is good for ReceiveSpeedLimit, but it won't work for client's SendSpeedLimit when remote server checks gap between two PDUs.
Post Reply