C/C++ Server Pages

One of the options when it comes to developing server side generated web pages, including AJAX and REST services, is to use what we refer to as C Server Pages, or CSP for short.

CSP is a technology that makes it possible to insert C or C++ code in HTML template files by using special CSP tags. This technology is similar to other server side technologies such as JSP, PHP, ASP, etc. The Barracuda Web Server SDK provides a number of host tools that compile and link CSP files. The tools function similar to a pre-processor and convert the CSP files to either C or C++ code. The produced C/C++ code is compiled using your standard C/C++ (cross) compiler, and the code is then linked with your application.

CSP Page Counter Example:

<%! int count; %>

<%!! count = 1; %>

<html>
  <body>
    <p>
      You are visitor <%="%d" count++%>.
    </p>
  </body>
</html>


CSP is great, but using C during the development process incurs some overhead as shown in the figure below.

Choosing the Best Device Management Framework

In modern web development, it's common to perform incremental testing as you build your application. However, the process of compiling C code can slow down development and make it more time-consuming. That's why we offer a rapid development framework called Lua Server Pages (LSP), which can significantly reduce the amount of time it takes to build web-based applications. LSP has many benefits, including fast development, easier maintenance, and safer code. If you're considering using C alone for your project, it's worth considering the benefits of using a high-level scripting language like Lua in combination with C. This can help make development more efficient, enjoyable, and safe, especially for modern web-based device management applications.

Before deciding on C only, check out the following:

Refer to our online CSP documentation for a detailed introduction to C Server Pages.


Next: Why Use Lua