Connecting to an SMSC

Create an SmppClient instance

SmppClient client = new SmppClient();

Then provide connection details by populating the SmppClient.Properties property

SmppConnectionProperties properties = client.Properties;
properties.SystemID = "mysystemid";
properties.Password = "mypassword";
properties.Port = 2034; //IP port to use
properties.Host = ""; //SMSC host name or IP Address
properties.SystemType = "mysystemtype";
properties.DefaultServiceType = "mydefaultservicetype";

//Resume a lost connection after 30 seconds
client.AutoReconnectDelay = 3000;

//Send Enquire Link PDU every 15 seconds
client.KeepAliveInterval = 15000;

//Start smpp client

Additionally, you can handle the SmppClient.ConnectionStateChanged event to receive notifications when connection status changes

client.ConnectionStateChanged += client_ConnectionStateChanged;

private void client_ConnectionStateChanged(object sender, ConnectionStateChangedEventArgs e)
     switch (e.CurrentState)
          case SmppConnectionState.Closed:
             //Connection to the remote server is lost
             //Do something here

              e.ReconnectInteval = 60000; //Try to reconnect after 1 min
          case SmppConnectionState.Connected:
             //A successful connection has been established
          case SmppConnectionState.Connecting:
              //A connection attemp is still on progress

Last edited Apr 17, 2011 at 10:12 AM by bentesha, version 1


AhmedNegm May 23 at 1:19 PM 
What are the proper Encoding to get Arabic messages correctly? ASCII, SMSCDefault and UCS2 are not working well.

vaananart Apr 15, 2015 at 12:57 AM 
Hi, The SMSC i'm connecting to, has username field. How can I'm extend the field in SmppClient for this field to be used in socket.

bofloa May 17, 2014 at 11:43 AM 
what namespace containe sourceAddress.Npi and Ton

choujoun Apr 15, 2014 at 1:58 PM 
How can i get SystemID , Password, DefaultServiceType, SystemType??

Waelalwirr Apr 8, 2014 at 12:16 PM 
How can we add the destination NPI and Ton ?

gaurang1next Jun 24, 2013 at 3:22 PM 
Just started to use this and get System.NullReferenceException exception on the SendMessage() line. I think I need to configure following parameters right? How do I configure following parameters? Before writng this code do I need to install anything on my machine?

properties.SystemID = "mysystemid";
properties.Password = "mypassword";
properties.Port = 2034; //IP port to use
properties.Host = ""; //SMSC host name or IP Address
properties.SystemType = "mysystemtype";
properties.DefaultServiceType = "mydefaultservicetype";

codexer Aug 2, 2011 at 8:35 AM 
@SparkyUK: The mentioned lib works!! I just tested this and I was able to send the message with alphanumeric sender. the message has been delivered and all semms to be OK. Here ist the way you can use it:
SmppClient mmclient = new SmppClient(); // init he client
SubmitSm mSubmitSM = new SubmitSm(); // init the submitsm method
//Populate SubmitSm properties as required
mSubmitSM.SourceAddress.Address = "IchSendeWas"; // alphanumeric sender
mSubmitSM.DestinationAddress.Address = "49123456789"; // destination MSISDN
mSubmitSM.DestinationAddress.Npi = NumberingPlanIndicator.Unknown; // destionation NPI
mSubmitSM.DestinationAddress.Ton = TypeOfNumber.Unknown; // destionation TON
mSubmitSM.SourceAddress.Npi = NumberingPlanIndicator.Unknown; // source NPI
mSubmitSM.SourceAddress.Ton = TypeOfNumber.Aphanumeric; // and here the important setting: TON - 5 (alphanumeric) - works for me :-)
mSubmitSM.EsmClass = EsmClass.Default; // esm class
mSubmitSM.RegisteredDelivery = RegisteredDelivery.DeliveryReceipt; //reg_del to 1
mSubmitSM.ServiceType = "CMT"; // service type cellular messaging, - not mandatory to set, you can leave it
mSubmitSM.SetMessageText("äöüÄÖÜ@€", DataCoding.SMSCDefault); // send msg - all OK, message received on handset with Sender "IchSendeWas"

SparkyUK Jul 4, 2011 at 2:36 PM 
Some networks in the UK require a correct TON setting.
Currently, 'Net.Lib.TypeOfNumber.Aphanumeric' doesn't appear to work.
Any chance this could be fixed? If an invalid TON is used, the message is not delivered on some networks.

I am setting this, as such:

client.Properties.AddressTon = Net.Lib.TypeOfNumber.Aphanumeric

Fasasisparks Apr 24, 2011 at 9:11 AM 
With the connection details, i believe i was able to connect to the SMSC server successfully