OZEKI NG SMS Gateway
"The World's most reliable SMS gateway software!"
info@ozekisms.com
Tel.: 00 36 52 532 731
Overview Quick start Download Manual How to buy FAQ Contact Us
OZEKI NG SMS Gateway - Product Guide

Delphi SMS API Contents | Searchc++ HTTP SMS example

Home > Product Manual > Developers Guide > Cpp SMS API

SMS Gateway SMS Gateway Home

  Product Manual
  Introduction
  SMS technology
  Installation Guide
  User Guide
  Developers Guide
  Tutorials
  ASP SMS API
  PHP SMS API
  HTTP SMS API
  SQL SMS API
  C Sharp SMS API
  AJAX SMS API
  Delphi SMS API
  Cpp SMS API
  c++ HTTP SMS example
  Java SMS API
  VB.NET SMS API
  Python SMS API
  Perl SMS API
  TCL/TK SMS API
  Coldfusion SMS API
  VB 6 SMS API
  Examples and Solutions
  Appendix
  FAQ
  Feature list
  Commercial Information
  Search
 


Automated phone calls?
Ozeki Phone System XE VoIP PBX software is an advanced PBX built for automated voice calls and 2 way SMS messaging. It has outstanding APIs for software developers. It can be used for:

Phone calls from SQL
Phone calls from HTTP
Voice and SMS applications

Callcenter developers
If you are working on telephone solutions, please check out the Ozeki VoIP SIP SDK.
It can be used to create VoIP client and server software.

Contact Us!
If you wish to get further information, do not hesitate to contact us!

E-mail: info@ozekisms.com

If you have a technical question, please submit a support request on-line.

C++ SMS SDK for Visual Studio


This example application was written in C++ using Visual Studio 2008 for to illustrate how you can send and receive SMS messages. The example uses the ozApi.dll file, that allows you to connect to Ozeki NG SMS Gateway over the network. The source code of the ozApi.dll is also included.

Download: c++-sms-sdk-with-source.zip (6MB)

Introduction

The C++ SMS SDK included in the downloadable example, opens a TCP/IP socket over the network to the SMSC and uses this socket to send and receive messages (Figure 1). It sends the SMS message after logging into the SMSC using a username and password. To use this example, you should setup an Ozeki NG SMS gateway instance on one of your servers in the network. The SMS gateway can operate a GSM modem or GSM phone attached to it with a data cable or it can connect to SMS service providers over the Internet. In the SMS gateway, you should create a standard user account and use that user account in this SMS C++ example.

This architecture can be used to access SMPP SMSC using C++. Of course not only C++ SMPP SMS connection is possible. You can setup C++ UCP SMS, C++ CIMD2 SMS and C++ modem AT command SMS solution with it.


Figure 1 - C++ SMS API to connect to SMSC

C++ example code

The following example gives you a quick insight on how to use this C++ SMS API.

#include "../ozApi/ozApi.h"
#include <iostream>
#include <string>
#include <Windows.h>
using namespace std;

// dll description
HINSTANCE hDLL = NULL;

// This function unload ozApi.dll
void UnLoadOzekiApi()
{
        FreeLibrary((HMODULE)hDLL);
}

// This function load ozApi.dll
ozApi* LoadOzekiApi()
{
        HINSTANCE hDLL = NULL;
        SmsConnection conn;

        // Load ozApi.dll
        hDLL = LoadLibrary("ozApi.dll");

        if (hDLL != NULL)
        {
                conn = (SmsConnection)GetProcAddress((HMODULE)hDLL, "CreateSmsConnection");
            if (conn != NULL) return conn();
                UnLoadOzekiApi();
        }

        return NULL;
}


int main(int argc, char** argv)
{
        // Load ozApi dll and connect to it.
        ozApi* myConn = LoadOzekiApi();
        if (myConn == NULL)
        {
                // Error while connect to dll.
                cout << "Unable to load ozApi.dll" << endl;
                system("pause");
                return 0;
        }
        else
        {
                // Dll is loaded.
                cout << "Loaded" << endl;
        }

        // Connect to Ozeki NG SMS Gateway
        // on localhost (127.0.0.1) at port 9500.
        myConn->open("127.0.0.1", 9500);

        // Login with default username and password
        // (admin / abc123)
        if(myConn->login("admin", "abc123"))
        {
                // Send a test message to 0011111
                myConn->sendMessage("0011111", "Test Message.");
        }
        else
        {
                // If username/password is bad
                cout << "Bad usename or password" << endl;
        }


        // Closing connection.
        cout << "Closing connection..." << endl;
        myConn->close();

        // Unload ozApi.dll
        UnLoadOzekiApi();
        cout << "Done" << endl;

    return 0;
}


Dig deeper!
People who read this also read...






Next page: c++ HTTP SMS example
Copyright © 2000 - 2014 Ozeki Informatics Ltd.
All rights reserved

Software PBX for Windows | VoIP SDK   |   Legal information   |   Privacy policy   |   Terms of use
Please, address your inquiries to info@ozekisms.com