Ozeki 10
Ozeki NG SMS Gateway
Message Server 6
On-line manual
SMS technology
MMS technology
Product features
Installation guide
User guide
Developers guide
General information
Files SMS
Java SMS
Delphi SMS
Access SMS
Case studies
How to buy
SMS Wall
IP SMS Gateway
Android SMS
Excel SMS
Bulk Messenger
Developer tools

On-line manual:
  Explore all the features in this On-line HTML documentation of Ozeki Message Server 6.

Product guide:
  Download Ozeki Message Server 6 Manual in PDF format. This PDF guide explains all the features of Ozeki Message Server 6.
Ozeki Message Server 6
Delphi SMS Delphi SMS | Access SMS Access SMS


On this page C# developers can learn how to use the HTTP protocol for SMS messaging with the Ozeki Message Server.


HTTP is the primary transport mechanism for communicating with resources over the World Wide Web. Developers often use this protocol because of its simplicity and popularity, and also because it enables them to bypass firewalls and proxies. HTTP is a request/response protocol between clients and servers. Using the Ozeki Message Server you can easily send SMS messages with a simple HTTP request. You can also receive SMS messages using the Ozeki SMS Server by implementing a very simple web server.


If you would only like to send messages using the HTTP protocol, you do not need to configure the Ozeki Message Server. Therefore, you may as well skip this paragraph. However, if you also want to receive SMS Messages, you need to configure the OZEKI Message Server to enable it to act as an HTTP Client. For this, you need to install and configure a HTTP Client plugin. To find out how to install and configure the HTTP Client plugin, check out the following page:

HTTP Client Plugin. In the appropriate tab, you need to set a base URL where the messages will be sent.

By configuring the HTTP Client plugin, you instruct the Ozeki Message Server to forward all incoming SMS messages to the base URL with the specified parameters. As a result, a web server listening on the base URL can easily process the messages.

Sending SMS using HTTP request/response in C#

To send SMS using the HTTP protocol, you only need to create a web request to the Ozeki Message Server. You can also receive the results of your request with a web response. In C# you can achieve this with a few lines of code:

// prepare the web page we will be asking for
   getUri = @"
   password=abc123&recepient=" + recepient.ToString() + @"&messageData=" +

WebRequest request = (WebRequest)WebRequest.Create(getUri);
// execute the request
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

//read the response
StreamReader responseReader =
             new StreamReader(response.GetResponseStream());
String resultmsg = responseReader.ReadToEnd();

You have to create a special HTTP request to the OZEKI Message Server, which listens on the 9333 port by default. This request starts with the hostname and the name of the port the Ozeki Server listens on ( in our example). You need to request a virtual page called ozeki and send it the parameters, depending on the action you intend to perform. For sending SMS messages you have to use:

login=[admins login],
password=[admins password],
recepient=[phone number of the recepient],
messageData=[the message you wish to send].                     

See more at :

After creating the request and calling the GetResponse() method on the request, the SMS Message will be sent, and you can optionally read the response. The response should look like this:

                &lt;StatusText&gt;Message accepted for

Receiving SMS using HTTP request/response in C#

To receive SMS messages using HTTP, you need to start a simple web server which is very easy in C# on Windows XP, SP2 or Server 2003. First, you need to create a new HttpListener object using the constructor of the HttpListener class . Use the Prefixes property to gain access to a specific Uniform Resource Identifier (URI), which will be the base URL.
(Note: Prefixes have to end in a forward slash �/�.) Next, start this listener and write a callback method which will handle all requests to your server. The BeginGetContext() method begins an asynchronous (non-blocking) call to receive incoming client requests. For performance reasons, start 20 of them.

public class HttpServer
private HttpListener listener;

public HttpServer()
       listener = new HttpListener();
       listener.Prefixes.Add("");//server url
       //Start 20 servers
       for (int x = 0; x < 20; x++)
       listener.BeginGetContext(new AsyncCallback(ListenerCallback),

protected void ListenerCallback(IAsyncResult result)
       if (this.listener == null) return;
       HttpListenerContext context =
       //We setup a new context for the next request
       this.listener.BeginGetContext(new AsyncCallback(ListenerCallback),

//Overridable method that can be used to implement a custom handler
protected virtual void ProcessRequest(HttpListenerContext context)
      string Sender = context.Request.QueryString["sender"];
      string Receiver = context.Request.QueryString["receiver"];
      string Msg = context.Request.QueryString["msg"];

      byte[] buffer =
{+36201111245}{Thank you for the answer}" +
      context.Response.OutputStream.Write(buffer, 0, buffer.Length);

Once your web server receives a HTTP request, the callback (ListenerCallback()) function will be called. This method will end the asynchronous operation with the EndGetContext() and immediately start a new context for the next request. The ProcessRequest() method can now process the incoming request. Each parameter of the request can be accessed by its name. For example, the message data will be in context.Request.QueryString["msg"].
(Note: If you want the output to be displayed on a GUI, consider you are on another thread, so watch out for illegal cross-thread calls.) After your server has received a request, you should send back a response which looks like this:

"{SMS:TEXT}{}{[sender number]}{[recipient number]}{[message text]}"       

In the request the sender�s number is optional, but the recipient�s number and the message text are mandatory.

Copyright © 2000- - Ozeki Informatics Ltd. | | Tel: +36 1 371 0150
Home > Products > SMS > Message Server 6 > On-line manual > Developers guide > Languages > C# SMS
Page: 754 | Login