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 understand that addEventListener isn't IE friendly, but I'm curious about this approach in
I have an existing website that uses the same code base, but is deployed
I understand that this isn't necessarily the best style question for stackoverflow but with
I understand that JavaScript isn't really made to open and save files. The best
Why isn't HashAlgorithm.Dispose public? void IDisposable.Dispose() { this.Dispose(true); GC.SuppressFinalize(this); } I understand that it
I understand that this question isn't one in that I'm going to get a
I have a jQuery get request that isn't working. I don't understand why, because
I understand that AJAX is asynchronous, and all that. But I have the following
I have a problem which isn't really that big, but still gives me some
So, I understand that the following doesn't work, but why doesn't it work? interface

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.