Table of Contents

Authentication (Bind)

The login and password issued by an SMPP-provider is required to pass authentication at SMPP-server.

Authentication to be performed after connection established successfully. Login and password transmitted to server with asynchronous method BindAsync. In BindAsync method you can also specify ConnectionMode. When calling BindAsync the third parameter (Connection Mode) is optional and, if not specified, by default it is Transceiver.

if (await _client.ConnectAsync("localhost", 7777))
{
    BindResp bindResp = await _client.BindAsync("Login", "Password", ConnectionMode.Transceiver);
}

Calls to methods ConnectAsync and BindAsync are to be accompanied with “await” operator. It guarantees getting to Bind operation only after Connect was successful.

In the following example, variable bindResp contains the result of BindAsync execution, in particular the server response and status.

if (bindResp.Header.Status == CommandStatus.ESME_ROK)
{
    _log.Info("Bound with SMPP server");
}

ESME_ROK status confirms successful execution of authentication command and means you can proceed with sending and/or receiving messages. The SmppClient object will change its Status to Bound.

Read more about statuses in the article Sending Commands and Getting Responses.