Basically this is a similar model of running that software uses often. One very close to it would be Apache for example.

When you fork off a child, it inherits all the parents handles, so what happens with the Apache example is
1) Main daemon listens on port 80
2) request comes in
3) Parent forks child to deal with request
3a) Child inherits all open filehandles and variables
4) Parent goes back to listening for requests
4a) Child processes request
5a) Child returns results
6a) Child wait x time prior to telling the Parent it is done with said request

While this isn't exactly technically accurate as to how Apache itself does it (as it maintains a pool of children to do its work, and only spawns more if its overloaded), its close enough for comparison.

Questions:
1) Is it worth it to queue the data up, or should you be processing real time streams?
2) How many "clients" are we talking about?
3) How far apart "logically" as well as "physically" are the "clients" and "servers"?
4) What is an acceptable timeout for client->server, server->client, server->server communication?

Yes it is possible to talk to a running process, provided the process has opened a 'socket' to deal with I/O. A socket can be a connection to a file, connection to the network stack, connection to a fifo or named pipe (which are really files, but we will ignore that for a sec and treat them differently), etc..

Named pipes are kinda cool. Alot of X applications make use of fifos in the /tmp or /var/tmp directory. Basically there is this handle they check, if there is data in the handle they slurp it in and process it, if not they go back to what they were doing and check back again later.

Personally I think your design is fine, and there are plenty of examples of forking servers, which is a fine search string to Super Search or Google for.

Hope that helps, and happy hacking

/* And the Creator, against his better judgement, wrote man.c */

In reply to Re: Daemon - Child - Client - Server by l2kashe
in thread Daemon - Child - Client - Server by PyroX

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.