Class SmppClient
SMPP protocol client class for connection with an SMSC over a TCP/IP and for sending or receiving short messages to and from the SMSC.
public class SmppClient : SmppClientBase, IDisposable
- Inheritance
-
SmppClient
- Implements
- Inherited Members
- Extension Methods
Constructors
SmppClient()
public SmppClient()
SmppClient(string)
public SmppClient(string name)
Parameters
name
string
Properties
ClientCertificates
Defines collection of Client Certificates
public X509CertificateCollection ClientCertificates { get; }
Property Value
ConnectionRecovery
Indicates whether the connection should be recovered.
public bool ConnectionRecovery { get; set; }
Property Value
- bool
True if connection should be recovered, false if not.
ConnectionRecoveryDelay
Gets or sets the delay before the connection will be recovered. Default is 2 minutes.
public TimeSpan ConnectionRecoveryDelay { get; set; }
Property Value
- TimeSpan
The connection recovery delay.
ConnectionTimeout
Gets or sets the time to wait while trying to establish a connection before terminating the attempt.
public TimeSpan ConnectionTimeout { get; set; }
Property Value
EnabledSslProtocols
Defines enabled versions of SSL Protocols for SMPP client.
public SslProtocols EnabledSslProtocols { get; set; }
Property Value
Methods
Bind(Bind)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<BindResp> Bind(Bind pdu)
Parameters
pdu
Bind
Returns
Bind(string, string, ConnectionMode)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<BindResp> Bind(string systemId, string password, ConnectionMode mode = ConnectionMode.Transceiver)
Parameters
systemId
stringpassword
stringmode
ConnectionMode
Returns
BindAsync(Bind)
Sends Bind PDU to SMPP Server. Performs authentication on the server.
public Task<BindResp> BindAsync(Bind pdu)
Parameters
pdu
BindThe PDU.
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
BindAsync(string, string, ConnectionMode)
Sends Bind PDU to SMPP Server. Performs authorization on the server.
public Task<BindResp> BindAsync(string systemId, string password, ConnectionMode mode = ConnectionMode.Transceiver)
Parameters
systemId
stringIdentifier for the system.
password
stringThe password.
mode
ConnectionModeThe connection mode.
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- NotSupportedException
When None specified.
Cancel(SmeAddress)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<CancelSmResp> Cancel(SmeAddress sourceAddress)
Parameters
sourceAddress
SmeAddress
Returns
Cancel(CancelSm)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<CancelSmResp> Cancel(CancelSm cancelSm)
Parameters
cancelSm
CancelSm
Returns
Cancel(string, string)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<CancelSmResp> Cancel(string messageId, string serviceType = null)
Parameters
Returns
CancelAsync(SmeAddress)
Cancels previously submitted short message that is still pending delivery.
public Task<CancelSmResp> CancelAsync(SmeAddress sourceAddress)
Parameters
sourceAddress
SmeAddress
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
CancelAsync(CancelSm)
Cancels previously submitted short message that is still pending delivery.
public Task<CancelSmResp> CancelAsync(CancelSm cancelSm)
Parameters
cancelSm
CancelSm
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
CancelAsync(string, string)
Cancels previously submitted short message that is still pending delivery.
public Task<CancelSmResp> CancelAsync(string messageId, string serviceType = null)
Parameters
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
Connect(EndPoint)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<bool> Connect(EndPoint endPoint)
Parameters
endPoint
EndPoint
Returns
Connect(string, int)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<bool> Connect(string host, int port)
Parameters
Returns
ConnectAsync(SmppClientConnectionOptions)
Connect to SMPP server using SmppConnectionOptions.
public Task<bool> ConnectAsync(SmppClientConnectionOptions options)
Parameters
options
SmppClientConnectionOptionsThe connection options
Returns
Exceptions
- ObjectDisposedException
Thrown when the instance is disposed.
- ArgumentNullException
Thrown when
options
parameter is not defined.
ConnectAsync(EndPoint)
Connect to SMSC using EndPoint instance
public Task<bool> ConnectAsync(EndPoint remoteEndPoint)
Parameters
remoteEndPoint
EndPointEndPoint instance. Can be IPEndPoint or DnsEndPoint
Returns
Exceptions
- ObjectDisposedException
Thrown when the instance is disposed.
ConnectAsync(EndPoint, EndPoint)
Connect to SMSC using EndPoint instance
public Task<bool> ConnectAsync(EndPoint remoteEndPoint, EndPoint localEndPoint)
Parameters
remoteEndPoint
EndPointEndPoint instance. Can be IPEndPoint or DnsEndPoint
localEndPoint
EndPointEndPoint instance. Associates a Socket with local endpoint.
Returns
Exceptions
- ObjectDisposedException
Thrown when the instance is disposed.
ConnectAsync(string, int)
Connect to SMPP server using hostname and port number.
public Task<bool> ConnectAsync(string host, int port)
Parameters
Returns
Exceptions
- ObjectDisposedException
Thrown when the instance is disposed.
Disconnect()
[Obsolete("Use the DisconnectAsync method. This method name will be removed in version 3.0.")]
public override Task Disconnect()
Returns
DisconnectAsync()
Disconnects client from remote endpoint
public override Task DisconnectAsync()
Returns
Dispose(bool)
protected override void Dispose(bool disposing)
Parameters
disposing
bool
Query(QuerySm)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<QuerySmResp> Query(QuerySm pdu)
Parameters
pdu
QuerySm
Returns
Query(string, SmeAddress)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<QuerySmResp> Query(string messageId, SmeAddress sourceAddress = null)
Parameters
messageId
stringsourceAddress
SmeAddress
Returns
QueryAsync(QuerySm)
Query the status of a previously submitted short message.
public Task<QuerySmResp> QueryAsync(QuerySm pdu)
Parameters
pdu
QuerySm
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
QueryAsync(string, SmeAddress)
Query the status of a previously submitted short message.
public Task<QuerySmResp> QueryAsync(string messageId, SmeAddress sourceAddress = null)
Parameters
messageId
stringsourceAddress
SmeAddress
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
Replace(ReplaceSm)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<ReplaceSmResp> Replace(ReplaceSm pdu)
Parameters
pdu
ReplaceSm
Returns
ReplaceAsync(ReplaceSm)
Replaces a previously submitted short message that is still pending delivery.
public Task<ReplaceSmResp> ReplaceAsync(ReplaceSm pdu)
Parameters
pdu
ReplaceSm
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
Submit(IBuilder<SubmitMulti>)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<SubmitMultiResp[]> Submit(IBuilder<SubmitMulti> builder)
Parameters
builder
IBuilder<SubmitMulti>
Returns
Submit(IBuilder<SubmitSm>)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<SubmitSmResp[]> Submit(IBuilder<SubmitSm> builder)
Parameters
Returns
- Task<SubmitSmResp[]>
Submit(SubmitMulti)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<SubmitMultiResp> Submit(SubmitMulti pdu)
Parameters
pdu
SubmitMulti
Returns
Submit(params SubmitMulti[])
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<SubmitMultiResp[]> Submit(params SubmitMulti[] pduList)
Parameters
pduList
SubmitMulti[]
Returns
Submit(SubmitSm)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<SubmitSmResp> Submit(SubmitSm submitSm)
Parameters
submitSm
SubmitSm
Returns
Submit(params SubmitSm[])
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<SubmitSmResp[]> Submit(params SubmitSm[] pduList)
Parameters
pduList
SubmitSm[]
Returns
- Task<SubmitSmResp[]>
Submit(IEnumerable<SubmitMulti>)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<IEnumerable<SubmitMultiResp>> Submit(IEnumerable<SubmitMulti> pduList)
Parameters
pduList
IEnumerable<SubmitMulti>
Returns
Submit(IEnumerable<SubmitSm>)
[Obsolete("Use the same method with Async suffix. This method name will be used in version 3.0 for synchronous processing.")]
public Task<IEnumerable<SubmitSmResp>> Submit(IEnumerable<SubmitSm> pduList)
Parameters
pduList
IEnumerable<SubmitSm>
Returns
SubmitAsync(IBuilder<SubmitMulti>)
Submits an array of SubmitMulti messages from SMS builder.
public Task<SubmitMultiResp[]> SubmitAsync(IBuilder<SubmitMulti> builder)
Parameters
builder
IBuilder<SubmitMulti>
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when
builder
parameter is not defined.
SubmitAsync(IBuilder<SubmitSm>)
Submits an array of SubmitSm messages from SMS builder.
public Task<SubmitSmResp[]> SubmitAsync(IBuilder<SubmitSm> builder)
Parameters
Returns
- Task<SubmitSmResp[]>
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when
builder
parameter is not defined.
SubmitAsync(SubmitMulti)
Submits a SubmitMulti message to the SMSC
public Task<SubmitMultiResp> SubmitAsync(SubmitMulti pdu)
Parameters
pdu
SubmitMulti
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
SubmitAsync(params SubmitMulti[])
Submits an array of SubmitMulti messages to the SMSC.
public Task<SubmitMultiResp[]> SubmitAsync(params SubmitMulti[] pduList)
Parameters
pduList
SubmitMulti[]
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
SubmitAsync(SubmitSm)
Submits a SubmitSm message to the SMSC
public Task<SubmitSmResp> SubmitAsync(SubmitSm submitSm)
Parameters
submitSm
SubmitSm
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
- ArgumentNullException
Thrown when request instance is null.
- GenericNackSmppException
Thrown when remote side returns negative acknowledgement (GENERIC_NACK) response, which means invalid or unknown command.
SubmitAsync(params SubmitSm[])
Submits an array of SubmitSm messages to the SMSC.
public Task<SubmitSmResp[]> SubmitAsync(params SubmitSm[] pduList)
Parameters
pduList
SubmitSm[]
Returns
- Task<SubmitSmResp[]>
SubmitAsync(IEnumerable<SubmitMulti>)
Submits an array of SubmitMulti messages to the SMSC.
public Task<IEnumerable<SubmitMultiResp>> SubmitAsync(IEnumerable<SubmitMulti> pduList)
Parameters
pduList
IEnumerable<SubmitMulti>
Returns
Exceptions
- InvalidOperationException
Thrown when PDU serialization is failed.
SubmitAsync(IEnumerable<SubmitSm>)
Submits a collection of SubmitSm messages to the SMSC.
public Task<IEnumerable<SubmitSmResp>> SubmitAsync(IEnumerable<SubmitSm> pduList)
Parameters
pduList
IEnumerable<SubmitSm>
Returns
Events
evAlertNotification
Occurs when received AlertNotification PDU
public event AlertNotificationEventHandler evAlertNotification
Event Type
evDeliverSm
Occurs when receiving DeliverSm PDU
public event DeliverSmEventHandler evDeliverSm
Event Type
evRecoverySucceeded
Occurs when connection recovery is succeeded.
public event BindRespEventHandler evRecoverySucceeded
Event Type
evServerCertificateValidation
Occurs when validating server certificate
public event EventHandler<CertificateValidationEventArgs> evServerCertificateValidation