-
Notifications
You must be signed in to change notification settings - Fork 35
Sending & Receiving Messages
Adham Awadhi edited this page May 9, 2017
·
2 revisions
Note: This article explains sending messages synchronously using Jamaa SMPP Client library. For more information about sending messages asynchronously, please read this guide Sending Messages Asynchronously
Before you can send/receive messages, you must first connect to an SMSC. For more information on how to connect to an SMSC, read this guide Connecting to an SMSC
TextMessage msg = new TextMessage();
msg.DestinationAddress = "255455388333"; //Receipient number
msg.SourceAddress = "255344338333"; //Originating number
msg.Text = "Hello, this is my test message!";
msg.RegisterDeliveryNotification = true; //I want delivery notification for this message
SmppClient client = GetSmppClient();
client.SendMessage(msg);
Note: Beta 1 release does not support concatenated messages. In this case you must limit the number of characters to not more than 160.
This version supported concatenated messages.
To receive messages, handle the SmppClient.MessageReceived event as follows:
SmppClient client = GetSmppClient();
client.MessageReceived += client_MessageReceived;
private void client_MessageReceived(object sender, MessageEventArgs e)
{
TextMessage msg = e.ShortMessage as TextMessage;
MessageBox.Show(msg.Text); //Display message
}