Framework for a server application (preferably using BOOST C ++)

I’m thinking of writing a server application — along the lines of mySQL or Apache.

Primary requirements:

  • Clients will communicate with the server via TCP / IP (sockets)
  • The server will spawn a new child process for processing requests (ala Apache)

Ideally, I would like to use the BOOST libraries, rather than trying to invent my own. There must be code somewhere that does most of what I'm trying to do, so I can use it (or at least part of it as a starting point), can someone point me to a useful link?

In the case (I hope it is unlikely) that there is no code that I can use as a starting point, someone can specify the most suitable BOOST libraries for use - and a general guide to the implementation.

My main concern is to find out when one of the children crashed. AFAIK, there are two ways to do this:

  • Use of heart contractions between parent and children (it quickly becomes erratic and introduces more things that may go wrong)
  • Somehow, wrap up the spawning process with a timeout parameter - but this is a stupid approach, because if the child does intensive work, the parent may incorrectly think that the child is dead.

What are the best practices for letting parents know that a child is dead?

[edit]

BTW, I develop / run / deploy on Linux

+3
6

, Pion - .
, , API .

Boost, :

  • Boost.Asio
  • Boost.Threading
  • Boost.Spirit( - HTTP-)
  • Boost.IPC
+2

(Windows/Linux/)? Windows , Linux, .

, , (, Apache) , , , Windows.

Linux, waitpid() ? , ,

+4

( Boost), ? , , , .

+1

, Boost.Asio - .

, :

  • Boost.Asio - , , Asio - (.. - boost::asio::io_service fork - )

    boost::asio::XX::socket - dup, .

    ? , , (, CppCMS booster.aio, , ).

  • , sigaction SIGCHLD, , . , , , waitpid, .

    asio "self-pipe", .

0

-, CPPCMS. .

, , boost:: asio - , .

, boost:: asio: cpp-netlib ( boost ) .

0

FOSS ++ .

https://github.com/chilabot/chila

: http://chilatools.blogspot.com/view/sidebar

It is especially suitable for creating a shared server (it was my motivation for creating it), but I think that it can be used for any type of application.

The part that needs to be deployed with the final binary is the LGPL, so it can be used with commercial applications.

0
source

Source: https://habr.com/ru/post/1775583/


All Articles