Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4336868
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T10:51:57+00:00 2026-05-21T10:51:57+00:00

I understand that as C++ isn’t dynamic, its not seen as a particularly great

  • 0

I understand that as C++ isn’t dynamic, its not seen as a particularly great base to build a website, but I believe it partly falls down to support. Are there any servers that run C++ programs as like a root, for example node.js creates the server and then handles all requests that go to the root yet CGI (which I don’t want to use) is like a Php webpage, limited to slow Apache with annoying re-writes. Are there any C++ librarys that let you easily embed a server.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T10:51:58+00:00Added an answer on May 21, 2026 at 10:51 am

    I recently (as in two days ago) had to rewrite a Java Jetty servlet in C++ (due to some JNI issues with OpenCV which I was also using). I had the exact same question as you and there’s no easy answer (I also didn’t want to use CGI). I suggest a couple of things:

    Use boost, use boost, use boost.
    Boost makes cross-platform deployment absolutely trivial and (dare I say it) fun! My dev machine is running Windows 7 but I had to deploy the server on a Linux server and boost made it incredibly easy.

    Use an HTTP library
    For my project, I found cpp-netlib, which makes writing servlets (if you can even call them that) very very easy. It offers access to request and response objects and even supports multithreading. Here’s the server example from their website:

    #include <boost/network/protocol/http/server.hpp>
    #include <string>
    #include <iostream>
    
    namespace http = boost::network::http;
    
    struct hello_world;
    typedef http::server<hello_world> server;
    
    struct hello_world {
        void operator() (server::request const &request,
                         server::response &response) {
            std::string ip = source(request);
            response = server::response::stock_reply(
                server::response::ok, std::string("Hello, ") + ip + "!");
        }
    };
    
    int
    main(int argc, char * argv[]) {
    
        if (argc != 3) {
            std::cerr << "Usage: " << argv[0] << " address port" << std::endl;
            return 1;
        }
    
        try {
            hello_world handler;
            server server_(argv[1], argv[2], handler);
            server_.run();
        }
        catch (std::exception &e) {
            std::cerr << e.what() << std::endl;
            return 1;
        }
    
        return 0;
    }
    

    Very neat-looking and (from what I’ve seen) it’s also very robust. Do not (do NOT) write your own HTTP 1.x implementation. I strongly advise against this because it’s a huge time investment and there’s no reason to reinvent the wheel.

    Do what works for you
    If you need your server to have some hot-swappable parts, feel free to use an easy scripting language like LUA – otherwise, just be ready to compile at every iteration.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an existing website that uses the same code base, but is deployed
I understand that creating too many threads in an application isn't being what you
I understand that some countries have laws regarding website accessibility. In general, what are
I understand that they are both supposed to be small, but what are the
I understand that Microsoft uses this template when versioning their products: Major.Minor.Build.Revision. Major is
I understand that requests are served by different threads, but do they all come
I understand that JavaScript isn't really made to open and save files. The best
I understand that AJAX is asynchronous, and all that. But I have the following
I understand that there are several ways to blend XNA and WPF within the
I understand that server-side validation is an absolute must to prevent malicious users (or

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.