Khalid

Khalid

  • NA
  • 33
  • 0

SMPP Receiving Message

Aug 11 2016 6:53 AM
Hello,
 
I am new to SMPP and I am using JamatechSMPP (an opensource .net library for SMPP) to connect to a SMSC. I am successfully able to send messages however I am unable to receive. Jamatech help documents say that an event called "client_MessageReceived" will be raised when a message is received but the receiving is failing and I am not sure how I can raise that event when a message is received. Please check my code. Any help will be highly appreciated. Thanks 
 
public static void ReceiveSMS()
{
try
{
ConnectToSMSC();
client.MessageReceived += new EventHandler<MessageEventArgs>(client_MessageReceived);
}
catch (Exception ex)
{
}
}
static public void client_MessageReceived(object sender, MessageEventArgs e)
{
//The event argument e contains more information about the received message
TextMessage textMsg = e.ShortMessage as TextMessage; //This is the received text message
int res = SaveMsg(textMsg.SourceAddress.ToString(), textMsg.Text.ToString());
}

Answers (2)