AdhamAwadhi / JamaaSMPP

Jamaa SMPP Client is a .NET implementation of the SMPP protocol that focuses on providing an easy-to-use and robust SMPP client library for .NET developers. This project is intended to be used by developers who want to integrate SMS functionalities in their applications as well as students who are learning the SMPP protocol.
https://github.com/AdhamAwadhi/JamaaSMPP/wiki
Other
45 stars 36 forks source link

Message more than 160 issue with Async feature #10

Closed poonamkumariasp closed 6 years ago

poonamkumariasp commented 6 years ago

Hi, I am facing issue while i am trying to send a long message using async feature. I am able to send same long message using sync feature. Please find the following code for your reference. Please help. I am stuck.

Thanks, Poonam

///

/// Sends SMS asynchronously /// public void SendSMSAsync() { TextMessage msg = new TextMessage(); msg.DestinationAddress = Settings.Default.SampleDestinationAddress; msg.SourceAddress = Settings.Default.SampleSourceAddress; msg.Text = Settings.Default.SampleMessageLong; msg.RegisterDeliveryNotification = Settings.Default.RegisterDeliveryNotification;

        SmppClient client = GetSmppClient();
        if (client.ConnectionState != SmppConnectionState.Connected) client.ForceConnect(5000);
        if (client.ConnectionState == SmppConnectionState.Connected)
            client.BeginSendMessage(msg, SendMessageCompleteCallback, client);            
    }
AdhamAwadhi commented 6 years ago

Can you tell what is the issue exactly? Did you got any exceptions? Or what?

poonamkumariasp commented 6 years ago

Hi Adham, I am getting thread was aborted exception in callback method.

My callback method is below:

///

/// Callback method /// /// private void SendMessageCompleteCallback(IAsyncResult result) { try { SmppClient client = (SmppClient)result.AsyncState; client.EndSendMessage(result);

        }
        catch (Exception e)
        {

        }
    }

Image:

![image](https://user-images.githubusercontent.com/13271953/35436318-9f305f1c-0296-11e8-9cec-bd5172b0009d.png exceptionsmpp

poonamkumariasp commented 6 years ago

Please let me know if you need further details on this. Thanks a lot.

AdhamAwadhi commented 6 years ago

I tried it, and it's worked. Can you send me the StackTrace and TargetSite of exception. I'm not sure but I think it's Timedout.

poonamkumariasp commented 6 years ago

Hi Adham,

Please share the code which is working for you for asynchronous. I am also having trouble in receiving mesgaes. I will try your code and see if that works for me.

Thanks, Poonam

On 28-Jan-2018 16:39, "AdhamAwadhi" notifications@github.com wrote:

I tried it, and it's worked. Can you send me the StackTrace and TargetSite of exception. I'm not sure but I think it's Timedout.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/AdhamAwadhi/JamaaSMPP/issues/10#issuecomment-361067812, or mute the thread https://github.com/notifications/unsubscribe-auth/AMqDkWEc0_kPbThLJ75-AiSuvmr9Xp-8ks5tPIaogaJpZM4RuCZU .

AdhamAwadhi commented 6 years ago

Please note I'm using SMPPSim for testing. The code is the same from DemoClient project. Just changed the msg.Text, send with client.BeginSendMessage(msg, SendMessageCompleteCallback, client); and used your SendMessageCompleteCallback

poonamkumariasp commented 6 years ago

It is working for me now. I think there was some issue in my unit test.