c# - About Jamaa SMPP Asynchronous operation -


i have implemented application using jamaa lib , jamaa net. developers.

but facing problem when use asynchronous sending operation. unhandled exception being raised continuously. highly appreciated if can me figure out problem.

please noted. receiving , sending sms using same application. need send on average 100,000 sms per day. simultaneously receiving sms smsc also. in advance.

my code snippet

namespace transciever  { class program {      static void main(string[] args)     {         smppclient client = new smppclient();         mysqlconnect con = new mysqlconnect();         textmessage msg = new textmessage();         settings settings = new settings();         smppconnectionproperties properties = client.properties;         string sysid = configurationmanager.appsettings["systemid"];         string pswd = configurationmanager.appsettings["password"];         string hst = configurationmanager.appsettings["host"];         int port = int32.parse(configurationmanager.appsettings["port"]);         properties.systemid = sysid;         properties.password = pswd;         properties.port = port ; //ip port use         properties.host = hst; //smsc host name or ip address         properties.systemtype = "";         properties.defaultservicetype = "";         //resume lost connection after 30 seconds         client.autoreconnectdelay = 3000;         //smppclient client1=getsmppclient();         //send enquire link pdu every 15 seconds         client.keepaliveinterval = 15000;          //start smpp client         try         {             client.start();          }         catch (exception ex)         {           }         client.messagereceived += new eventhandler<messageeventargs>(client_messagereceived);         while (true)         {             client.connectionstatechanged += (sender, e) =>             {                  switch (e.currentstate)                 {                      case smppconnectionstate.closed:                         // connection remove server lost                          try                         {                             client.start();                          }                         catch (exception ex)                         {                          }                          break;                      case smppconnectionstate.connected:                         //console.write("connected");                         break;                      case smppconnectionstate.connecting:                         break;                  }              };               string successquery = "";             var list = new list<smsoutbox>();             list = con.select("select msgid, srcmn,dstmn, msg table msgstatus='que' order msgid desc limit 500");             int listcount = list.count;             int = 0;             if (listcount > 0 && client.connectionstate == smppconnectionstate.connected)             {                 foreach (var row in list)                 {                     = + 1;                     msg.destinationaddress = row.dstmn;                     msg.text = row.msg;                     msg.sourceaddress = row.srcmn;                     msg.registerdeliverynotification = false;                     successquery += row.msgid.tostring() + ",";                     try                     {                         client.beginsendmessage(msg, sendmessagecompletecallback, client);                                              }                     catch (exception ex)                     {                       }                     if (i == 250)                     {                         try                         {                             if (successquery.length > 0)                             {                                 successquery = successquery.substring(0, successquery.length - 1);                                 successquery = "update smsoutbox_bl set msgstatus='sent' msgid in (" + successquery + ")";                                 con.update(successquery);                                 successquery = "";                             }                         }                         catch (exception ex)                         {                         }                         = 0;                     }//if i==250 ends                  }//foreach ends             }//if listcount>0 ends              if (i > 0)             {                 try                 {                     if (successquery.length > 0)                     {                         successquery = successquery.substring(0, successquery.length - 1);                          successquery = "update smsoutbox_bl set msgstatus='sent' msgid in (" + successquery + ")";                         //dbconnection.runsql(successquery);                         con.update(successquery);                         successquery = "";                     }                 }                 catch (exception ex)                 {                 }             }         }//while loop ends     }//main ends      static public void client_messagereceived(object sender, messageeventargs e)     {         //the event argument e contains more information received message         textmessage textmsg = e.shortmessage textmessage; //this received text message         try         {             mywebrequest myrequest = new mywebrequest("http://localhost/cde/cdeblrecv.php", "post", "mn=" + textmsg.sourceaddress + "&msg=" + textmsg.text + "&sc=3333");          }         catch(exception ex)         {         }     }      static private void sendmessagecompletecallback(iasyncresult result)     {         smppclient client = (smppclient)result.asyncstate;         client.endsendmessage(result);     }   }//class program ends here }//namespace ends here  

below exception thrown app.

unhandled exception: jamaatech.smpp.net.lib.smppexception: exception of type 'jamaatech.smpp.net.lib.smppexception' thrown.

server stack trace:

at jamaatech.smpp.net.client.smppclient.sendmessage(shortmessage message, int32 timeout) @ system.runtime.remoting.messaging.stackbuildersink._privateprocessmessage(intptr md, object[] args, object server, object[]& outargs) @ system.runtime.remoting.messaging.stackbuildersink.asyncprocessmessage(imessage msg, imessagesink replysink)

exception rethrown @ [0]: @ system.runtime.remoting.proxies.realproxy.endinvokehelper(message reqmsg, boolean bproxycase) @ system.runtime.remoting.proxies.remotingproxy.invoke(object notused, messagedata& msgdata) @ jamaatech.smpp.net.client.sendmessagecallback.endinvoke(iasyncresult result) @ jamaatech.smpp.net.client.smppclient.endsendmessage(iasyncresult result) @ transciever.program.sendmessagecompletecallback(iasyncresult result) in d:\smpp\transciever\apptranscieverincsharp\apptranscieverincsharp\program.cs:line 223 @ system.runtime.remoting.messaging.asyncresult.syncprocessmessage(imessage msg) @ system.runtime.remoting.messaging.stackbuildersink.asyncprocessmessage(imessage msg, imessagesink replysink) @ system.runtime.remoting.proxies.agileasyncworkeritem.threadpoolcallback(object o) @ system.threading.queueuserworkitemcallback.waitcallback_context(object state) @ system.threading.executioncontext.runinternal(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) @ system.threading.executioncontext.run(executioncontext executioncontext, contextcallback callback, object state, boolean preservesyncctx) @ system.threading.queueuserworkitemcallback.system.threading.ithreadpoolworkitem.executeworkitem() @ system.threading.threadpoolworkqueue.dispatch() @ system.threading._threadpoolwaitcallback.performwaitcallback()

you try use wireshark view raw packets, give idea going wrong. in case invalid system id.


Comments

Popular posts from this blog

java - Run a .jar on Heroku -

java - Jtable duplicate Rows -

validation - How to pass paramaters like unix into windows batch file -