SMPP client only receives one message.

Added by lukin about 7 years ago


I'm using the ISmppGateway in an application and i'm having the following problem.

The SMSC server has many messages in the queue but the OnDeliverSm event is only fired once and I have to restart my application for the event to be fired again.
Also the event is being fired always for the same message. It seems that the message is not removed from the server.

I've used the code of the demo app and the problem also happens in the demo app. When I disconnect and connect again to the server the same message is received.

The code i'm using is:

smppGateway = messageGateway.Find(smppGatewayConfiguration);
smppGateway.OnError += new MessagingToolkit.Core.Smpp.ErrorEventHandler(smppGateway_OnError);
smppGateway.OnBindResp += new BindRespEventHandler(smppGateway_OnBindResp);
smppGateway.OnUnbind += new UnbindEventHandler(smppGateway_OnUnbind);
smppGateway.OnClose += new ClosingEventHandler(smppGateway_OnClose);
// Bind the events
smppGateway.OnDeliverSm += new DeliverSmEventHandler(smppGateway_OnDeliverSm);
smppGateway.OnAlert += new AlertEventHandler(smppGateway_OnAlert);
private void smppGateway_OnDeliverSm(object source, MessagingToolkit.Core.Smpp.EventObjects.DeliverSmEventArgs e)
try {
Console.WriteLine("Receveived message - Source: " + e.DeliverSmPdu.SourceAddress + " Destination: " + e.DeliverSmPdu.DestinationAddress + " Sequence #: " + e.DeliverSmPdu.SequenceNumber);
catch (Exception ex) {

Thanks in advance.

Replies (3)

RE: SMPP client only receives one message. - Added by lukin about 7 years ago

Hello again,

In the documentation it is said that:

SmppGateway - Wrapper class to provide asynchronous I/O for the SMPP library. Note that most SMPP events have default handlers. If the events are overridden by the caller by adding event handlers, it is the caller's responsibility to ensure that the proper response is sent. For example: there is a default deliver_sm_resp implemented. If you "listen" to the deliver_sm event, it is your responsibility to then send the deliver_sm_resp packet.

Could the problem be that i'm listening to the OnDeliverSm event and am not sending the response?
And if so how can I simply receive the messages without having to send the deliver_sm_resp packet manually?

Thank you.

RE: SMPP client only receives one message. - Added by admin about 7 years ago


Add this at the end of smppGateway_OnDeliverSm and see if it helps.

SmppDeliverSmResp pdu = new SmppDeliverSmResp();
pdu.SequenceNumber = e.DeliverSmPdu.SequenceNumber;
pdu.CommandStatus = 0;