Repository navigation
Connecting to an SMSC
AdhamAwadhi edited this page May 9, 2017
·
2 revisions
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 = "196.23.3.12"; //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
client.Start();
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
break;
case SmppConnectionState.Connected:
//A successful connection has been established
break;
case SmppConnectionState.Connecting:
//A connection attemp is still on progress
break;
}
}