You are here: > SMS Component > Objects > SmppServer
ActiveXperts SMS Component


SMS Component - SmppServer object


The Short Message Peer to Peer protocol (SMPP) is used for sending and receiving SMS messages. It's a TCP/IP based binary application protocol which was specifically developed for high volume, low latency sending of SMS messages. The protocol supports all SMS features like delivery reports / binary SMS messages etc..

The SMPP Server object can be used to listen for incoming SMPP client connections. After starting the SMPP server every client will be represented by an SMPP session object and through these SMPP sessions objects you can receive SMS messages from the client and send SMS messages to the client.

Some advantages for using SMPP instead of a GSM modem:

  • Direct connection through internet/VPN. No other hardware or SIM card is required
  • Users can send SMS to a simple shortcode, this is not possible when sending to a GSM phone
  • The name of your company can be used as a sender ID instead of a phone number
  • High throughput, 200 or 300 message per second on a normal desktop class PC

The SmppServer object features the following:

  • Send and receive SMS messages through SMPP 3.3 and 3.4
  • Send and receive alphanumeric, Unicode and binary SMS messages
  • Supports bind/unbind/generic_nack/submit_sm/data_sm/query_sm and enquire_link commands
  • Connect up to 200 simultaneous SMPP clients on a desktop class PC
  • Delivery can be verified through delivery reports

The SmppServer object is part of the ActiveXperts SMS Component. Overview of all SMS Component objects:

  • Gsm - Send and receive SMS messages using a GSM modem or a modem-capable GSM phone.
  • Smpp - Send and receive SMS messages via an SMPP provider.
  • SmppServer - Accept incoming SMPP connections.
  • Http - Send SMS messages through an HTTP based SMSC provider interface over the internet.
  • Dialup - Send SMS messages using a Hayes compatible modem through TAP/XIO or UCP.
  • Snpp - Send pager messages via an SNPP provider through the internet/VPN.

Sample code

VBScript sample: Send and receive SMS messages to/from multiple clients simultaneously

Set objSmppServer = CreateObject("AxSms.SmppServer")   ' Create the SMPP server object
Set objConstants = CreateObject("AxSms.Constants")  ' Create the SMS constants object

' Show version information
Wscript.Echo "SMS Component" & objSmppServer.Version & "; Build " & _
  objSmppServer.Build & "; Module " & objSmppServer.Module
WScript.Echo "Expiration date: " & objSmppServer.ExpirationDate & vbCrLf

objSmppServer.Logfile = "server.log"
objSmppServer.Start 2775
If objSmppServer.LastError <> 0 Then
  WScript.Echo "Error while starting SMPP server: " & _
  WScript.Quit 1
End If
WScript.Echo "SMPP server started..."

While objSmppServer.IsStarted
  Set objSmppSession = objSmppServer.GetFirstSession
  While objSmppServer.LastError = 0
    ' Accept all sessions that request a bind
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BINDING Then
      WScript.Echo "Client IP: " & objSmppSession.Ip & ":" & objSmppSession.Port
      WScript.Echo "SystemId: " & objSmppSession.SystemId
      WScript.Echo "AddressRange: " & objSmppSession.AddressRange
      objSmppSession.LogFile = objSmppSession.SystemId & ".log"
      objSmppSession.RespondToBind objConstants.SMPP_ESME_ROK
    End If    
    If objSmppSession.ConnectionState = objConstants.SMPP_SESSIONSTATE_BOUND_TRX Then
      ' Receive incoming messages
      Set objMessage = objSmppSession.ReceiveSubmitSms
      While objSmppSession.LastError = 0
        WScript.Echo "Receive sms from: " & objSmppSession.SystemId & "; to: " & _
          objMessage.ToAddress & "; suggested reference: " & objMessage.Reference
        ' Accept the incoming message with the suggested message reference
        objSmppSession.RespondToSubmitSms objMessage
        If objSmppSession.LastError <> 0 Then
          WScript.Echo "Error while responding: " & _
          WScript.Quit 1
        End If
        ' Send a successful delivery report for the incoming message
        objMessage.SmppStatus = objConstants.SMPP_MESSAGESTATE_DELIVERED
        objSmppSession.DeliverReport objMessage
        If objSmppSession.LastError <> 0 Then
          WScript.Echo "Error while sending delivery report: " & _
          WScript.Quit 1
        End If
        Set objMessage = objSmppSession.ReceiveSubmitSms

      ' Deliver a new message to the client
      Set objMessage = CreateObject("AxSms.Message")
      objMessage.ToAddress = "+31122334455"
      objMessage.FromAddress = "+35544332211"
      objMessage.Body = "Hello from the ActiveXperts Gateway !"
      objMessage.UserTag = 1 ' To identify this message when the client responds
      objSmppSession.DeliverSms objMessage
      If objSmppSession.LastError <> 0 Then
        WScript.Echo "Error while delivering: " & _
        WScript.Quit 1
      End If
      ' Check if the client accepted any messages
      Set objMessage = objSmppSession.ReceiveDeliverResponse
      While objSmppSession.LastError = 0
        WScript.Echo "Response: " & objMessage.SmppCommandStatus & _
          " for UserTag: " & objMessage.UserTag
        Set objMessage = objSmppSession.ReceiveDeliverResponse
    End If
    Set objSmppSession = objSmppServer.GetNextSession

  objSmppServer.Sleep 1000


More samples

Samples are available for: C# .NET, Visual Basic .NET, Visual C/C++, VBA, ASP, ASP .NET, Java, Javascript, PHP, HTML, ColdFusion, Delphi and more.

On, you can find many SMS Component samples. Samples are also part of the SMS Component installation.