Async Submit Window Size

.NET library for SMPP protocol
Post Reply
Posts: 1
Joined: Tue Jan 02, 2018 6:30 am

Async Submit Window Size

Post by Sam » Tue Jan 02, 2018 11:29 am


Using client.SubmitAsync I am able to submit messages asynchronously. Now I need to set a maximum window size to restrict maximum number of submissions before requiring a response to at least one of the outstanding submission. Can anyone help with some sample code or related topics?

Site Admin
Posts: 854
Joined: Tue Apr 25, 2006 9:45 am

Re: Async Submit Window Size

Post by alt » Sun Mar 11, 2018 8:19 pm

For .NET 4.5 and higher you can use an approach described in following article ... nding.html
Posts: 1
Joined: Thu Aug 15, 2019 12:30 pm

Re: Async Submit Window Size

Post by myggan » Thu Aug 15, 2019 5:43 pm

I'm arriving a bit late to the party. Seems like the link is broken, I assume @alt referenced this site? ... nding.html

When it comes to window size you could do something like this

Code: Select all

public class Sender
    private readonly ISmppConfig _smppConfig;
    private static SemaphoreSlim semaphore
    private const int WINDOW_SIZE = 7;

    public Sender(ISmppConfig smppConfig)
        _smppConfig = smppConfig;
        semaphore = new SemaphoreSlim(WINDOW_SIZE, WINDOW_SIZE);

    public async Task Send()
        using (SmppClient client = new SmppClient())
            client.evDeliverSm += ClientOnEvDeliverSm;
            client.SendSpeedLimit = LimitRate.NoLimit;

            await client.Connect(_smppConfig.Host, _smppConfig.Port);
            await client.Bind(_smppConfig.SystemId, _smppConfig.Password);

            await Task.Run(async () => {
                await semaphore.WaitAsync();
                SubmitSmResp[] r = await client.Submit(
Post Reply