Sorry for the non-useful title, but I can't think of a simple description that covers what I'm trying to do.

I am writing a program to do data logging via a GPIB interface card, using Linux and the drivers/library from the linux-gpib.sourceforge.net project (but don't let that scare you off... my question isn't related to the details of GPIB).

What I need to do is keep my program running as a daemon at all times, but be able to communicate with it to control the instruments on the GPIB bus, start and stop writing to log files, etc.

I'm envisioning something that I could telnet to and issue a basic set of commands with verification that the command has been accepted.

On top of that, I *think* (but am not sure) that this would be a good application for threads, as this program will be communicating with three or four different devices on the bus, each of which is doing its thing independently of the others. The thread would handle sending commands to the instrument, reading the response, massaging the data, then writing it to a log file.

I wonder if someone would be kind enough to help me put together at least a skeleton of what a program like this might look like -- in particular, how to launch and manage threads via a telnet interface. I'm happy to fill in the blanks, but I'm not sure how to lay the program out at a high level.

Thanks!

John


In reply to Controllable daemon, threads, and other things by n8ur

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.