Hello fellow monks, I have been thinking about this one for sometime now and I just have not been able to come up with a sound solution.

I have a server that allows interactive use from the clients. The server talks to the clients using udp messages and logs everything that goes on. The clients that connect to the server have a unique ability to be able to send a single udp packet to each other or anything else listening on a port somewhere for a udp packet. The server can be remotely administered if sent the proper information.

So, to recap, I have a server that can be monitored two ways

  • Via logfile
  • Via remote commands (mostly...not fully)
  • and

  • The clients can send message requests somewhere via a udp message.
  • I want to be able to monitor the server for client requests and then react to those requests at the server level. The thing that makes this so difficult is:

    In order to watch the logfile, I have successfully created a routine that can watch the logfile with a tail -f like ability. This code however, is a true loop in itself...

    Now, the next thing I decided to do was set up the ability to create a UDP server in perl so that the client can talk to my server and send requests that way. The thing that makes this difficult is:

    The UDP server listens via a true loop.

    See my problem? I can't have two true loops running independently of each other simultaneoulsy can I?

    Here is what I have thought of doing; modular construction of the script. Create a main script that handles the spawning of two children processes that talk to the main script. The two children processes will actually be the network piece and the logfile watching piece. They will tell the main piece what to do which has the networking code in place to talk to the server.

    My question is this: Is this the best way to go? Is my idea capable of working or should I think of some other more foolproof way? I have never used IPC before, but perhaps this would be a decent time to learn? Should I use IPC?

    TIA

    ----------
    - Jim


    In reply to Should I use IPC? Perhaps something else...*shrug* by snafu

    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.