Stack Overflow Exception

.NET library for SMPP protocol
Locked
acikabt
Posts: 2
Joined: Mon Jan 24, 2011 1:30 am

Stack Overflow Exception

Post by acikabt » Wed Jan 26, 2011 10:59 am

I've located a problem while sending a large quantity of SMS messages when I am connected to SMPP server via SSL connection.
Error occurs in the demo app if you do the following:

1. Connect to SMPP server via SSL connection
2. Use "Bulk async submit"
3. Change the Balk function, because I want to receive delivery report for every message I'm sending

for (int i = 0; i < count; i++)
{
List<Inetlab.SMPP.PDU.SubmitSm> req = client.PrepareSubmit(
mode,
byte.Parse(tbSrcAdrTON.Text),
byte.Parse(tbSrcAdrNPI.Text),
tbSrcAdr.Text,
byte.Parse(tbDestAdrTON.Text),
byte.Parse(tbDestAdrNPI.Text),
tbDestAdr.Text,
coding,
tbSend.Text);

foreach (Inetlab.SMPP.PDU.SubmitSm sm in req)
{
sm.ValidityPeriod = DateTime.Now.AddDays(2).ToString("yyMMddhhmmss000+");
sm.RegisteredDelivery = 1;
}

client.SubmitAsync(req);
Application.DoEvents();

}//for

After a while application crashes and gives the message:
An unhandled exception of type 'System.StackOverflowException' occurred in System.dll

Error is risen while calling client.SubmitAsync(req);

More precise:
in SmppClientBase.cs file
in internal void SendPDU(SmppPDU pdu) method
while executing IAsyncResult ar = _networkStream.BeginWrite(data, 0, data.Length, SentMethodCallback, so);

I want to point out that this is only a case when I'm using SSL connection, if I connect without SSL it works perfect.



Also I would like to ask you which is the best way to send a large quantity of SMS to different numbers and with different text message for every submitted SMS with the ability to receive delivery report.

I noticed that using client.SubmitAsync(req) makes automatically PDU's for concatenated messages which is great. Also there is a method:
client.SubmitTextAsync for concatenated messages but how can I set it to receive delivery reports?

Thank you in Advance
alt
Site Admin
Posts: 985
Joined: Tue Apr 25, 2006 9:45 am

Re: Stack Overflow Exception

Post by alt » Mon Jan 31, 2011 9:56 pm

Hello,

Thank you for pointing this to me.

Your code is ok.

Problem comes from SslStream implementation. It doesn't support asynchronous operations.
I'm going to use queue in this case and send messages in separate thread.
I hope I'll release new version soon.

Kind regards,
Alexey
Locked