Hello,
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?
Thanks
Async Submit Window Size
Re: Async Submit Window Size
For .NET 4.5 and higher you can use an approach described in following article
https://docs.inetlab.com/smpp/articles/ ... nding.html
https://docs.inetlab.com/smpp/articles/ ... nding.html
Re: Async Submit Window Size
I'm arriving a bit late to the party. Seems like the link is broken, I assume @alt referenced this site?
https://docs.inetlab.com/smpp/v1/articl ... nding.html
When it comes to window size you could do something like this
https://docs.inetlab.com/smpp/v1/articl ... 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(
SMS.ForSubmit()
.From("Test")
.To("123456798")
.Coding(DataCodings.UCS2)
.Text("test"));
semaphore.Release();
});
}
}
}