Message Server 6
"The world's favourite SMS server"
Tel.: 00 36 52 532 731

SMS 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
Excel SMS

On-line manual:
  Explore all the features in this on-line HTML documentation.
Product guide:
  This downloadable pdf explains all the features of Message Server 6.

  Sign up to get news about product updates!

  You can send tech. questions in e-mail to the following address: info @ ozeki.hu

Did you know?
Ozeki offers a very high performance SMS Gateway system as well called Ozeki NG SMS Gateway. It can send and receive up to 500 SMS messages per second.

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.

Ozeki VoIP SIP SDK is a great tool for software developers who wish to get involved in voip phone client or voip phone service development.


Delphi SMS Contents | SearchAccess SMS

Home > Developers guide > Languages > C# 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 : http://www.ozeki.hu/index.phtml?ow_page_number=654page_name=sms_HTTP_Server_SMS

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.

Next page: Access SMS

Ozeki Cookie Policy
Ozeki Informatics Ltd uses cookies to provide you the best experience on this website. The further use of the website will be considered as an agreement to the use of cookies. For more information read this website.