Greetings folks,

Over the years I have read on and off about how perl manages servers, non-blocking vs blocking, forking vs select, client-server, etc.

One thing that I'm interested in doing is writing a server that listens to a connection but then also acts as a client itself. It in turn would connect to the exact same server running somewhere else.

The purpose is to take information it learns as a client and in turn repeat it to as a server to its clients. Of course, each of these clients are also copies of the same server running elsewhere.

The data is nothing more than a table whose content would occasionally change - but changes must be transmitted and received and duplicates discarded - almost like a database, but purely in memory since it's never meant to be permanently kept.

As suspected, data would need to be shared between each process. We're not talking hundreds of megabytes of data, actually something on the order of a few hundred kilobytes with a little bit of churn (kilobytes).

I have the abstract algorithm down, but I'm not sure if I should use forking with IPC or threads. Anyone have some advice?

Thanks

In reply to A server that has a fool as its client: itself by Anonymous Monk

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.