Get reference to instance of daemon class

Discussion in 'C++' started by Michael Ransburg, Jun 9, 2004.

  1. Hi!

    I have implemented a daemon in C++. It runs all the time, between
    reboots. Is there a way for other C++ classes to get a reference to
    the instance of this daemon class in order to call its methods
    directly?

    E.G.:

    1) System Start - daemon class is instantiated and launched
    2) System Start + 5 Minutes: user class is instantiated and launched
    3) user instance wants to access methods of daemon instance
    4) user instance calls "getClassInstance('daemon')" to get a reference
    to the instance of the daemon class
    5) user calls daemon.getInformation();

    It's step 4) I'm not sure how to do.

    Any assistance would be highly appreciated.

    Thanks,
    Michael
     
    Michael Ransburg, Jun 9, 2004
    #1
    1. Advertising

  2. Michael Ransburg wrote:
    > I have implemented a daemon in C++. It runs all the time, between
    > reboots. Is there a way for other C++ classes to get a reference to
    > the instance of this daemon class in order to call its methods
    > directly?


    If there is, it's very OS-specific. Please ask in a newsgroup
    dedicated to your OS. Inter-process communication is not part
    of C++ language.

    V
     
    Victor Bazarov, Jun 9, 2004
    #2
    1. Advertising

  3. Michael Ransburg

    raj Guest

    (Michael Ransburg) wrote in message news:<>...
    > Hi!
    >
    > I have implemented a daemon in C++. It runs all the time, between
    > reboots. Is there a way for other C++ classes to get a reference to
    > the instance of this daemon class in order to call its methods
    > directly?
    >
    > E.G.:
    >
    > 1) System Start - daemon class is instantiated and launched
    > 2) System Start + 5 Minutes: user class is instantiated and launched
    > 3) user instance wants to access methods of daemon instance
    > 4) user instance calls "getClassInstance('daemon')" to get a reference
    > to the instance of the daemon class
    > 5) user calls daemon.getInformation();
    >
    > It's step 4) I'm not sure how to do.
    >
    > Any assistance would be highly appreciated.
    >
    > Thanks,
    > Michael


    hey Michael

    This is not a c++ question. Please google for shared memory / inter
    process communciation for your operating system

    Raj
     
    raj, Jun 9, 2004
    #3
  4. Michael Ransburg

    JKop Guest

    Michael Ransburg posted:

    > Hi!
    >
    > I have implemented a daemon in C++. It runs all the time, between
    > reboots. Is there a way for other C++ classes to get a reference to
    > the instance of this daemon class in order to call its methods
    > directly?
    >
    > E.G.:
    >
    > 1) System Start - daemon class is instantiated and launched
    > 2) System Start + 5 Minutes: user class is instantiated and launched
    > 3) user instance wants to access methods of daemon instance
    > 4) user instance calls "getClassInstance('daemon')" to get a reference
    > to the instance of the daemon class
    > 5) user calls daemon.getInformation();
    >
    > It's step 4) I'm not sure how to do.
    >
    > Any assistance would be highly appreciated.
    >
    > Thanks,
    > Michael


    Well regardless of your target platform, you'll want to do something like
    the following in your prog:


    Daemon* daemon = new Daemon;


    Now, you'll have to agree on a rendevouz point in order for your "user" one
    to know where this daemon is. Maybe something like a Mutex or something
    would work, giving it a predefined name, let's say "DaemonnomeaD".

    Now, the other prog will do something like the following:

    Daemon* current_daemon = GetTheAddressOfThatDaemonFromWherever();

    current_daemon->getInformation();



    If you're planning on writing some sort of virus or spyware, I suggest you
    hit the books, you haven't near enough knowledge to pull it off at the
    moment!


    -JKop
     
    JKop, Jun 9, 2004
    #4
  5. Thanks for your answer!

    > If you're planning on writing some sort of virus or spyware, I suggest you
    > hit the books, you haven't near enough knowledge to pull it off at the
    > moment!


    Just curious, why do you assume that I want to do such a thing?

    Best regards,
    Michael
     
    Michael Ransburg, Jun 14, 2004
    #5
  6. Michael Ransburg

    JKop Guest

    Michael Ransburg posted:

    > Thanks for your answer!
    >
    >> If you're planning on writing some sort of virus or spyware, I suggest
    >> you hit the books, you haven't near enough knowledge to pull it off at
    >> the moment!

    >
    > Just curious, why do you assume that I want to do such a thing?
    >
    > Best regards,
    > Michael



    Airgead
    Geld
    Dinero
    Argent
    Soldi
    Dinheiro
    Money


    That would be a motive.

    But the name "Daemon" suggested it to me. I see all sorts of crappy worms
    and viruses with names like "Gremlin", "Annihilator".


    -JKop
     
    JKop, Jun 14, 2004
    #6
  7. On Mon, 14 Jun 2004 21:41:27 GMT, JKop <> wrote:

    >Michael Ransburg posted:
    >
    >> Thanks for your answer!
    >>
    >>> If you're planning on writing some sort of virus or spyware, I suggest
    >>> you hit the books, you haven't near enough knowledge to pull it off at
    >>> the moment!

    >>
    >> Just curious, why do you assume that I want to do such a thing?
    >>
    >> Best regards,
    >> Michael

    >
    >
    >Airgead
    >Geld
    >Dinero
    >Argent
    >Soldi
    >Dinheiro
    >Money
    >
    >
    >That would be a motive.
    >
    >But the name "Daemon" suggested it to me. I see all sorts of crappy worms
    >and viruses with names like "Gremlin", "Annihilator".
    >
    >
    >-JKop


    http://en.wikipedia.org/wiki/Daemon_(computer_software)

    You might want to do a little homework before slinging accusations.
     
    Frederic Banaszak, Jun 15, 2004
    #7
  8. > >Airgead
    > >Geld
    > >Dinero
    > >Argent
    > >Soldi
    > >Dinheiro
    > >Money
    > >
    > >
    > >That would be a motive.
    > >
    > >But the name "Daemon" suggested it to me. I see all sorts of crappy worms
    > >and viruses with names like "Gremlin", "Annihilator".
    > >
    > >
    > >-JKop

    >
    > http://en.wikipedia.org/wiki/Daemon_(computer_software)
    >
    > You might want to do a little homework before slinging accusations.


    Indeed, I'm actually researching some more efficient (exotic? ;-)) IPC
    possibilities for a project I'm involved at the University where I'm
    doing my pHD right now ;-) It got me a little surprised (and curious)
    to find myself in the position of an accused spyware writer so quickly
    ;-)

    Best regards,
    Michael
     
    Michael Ransburg, Jun 15, 2004
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Sridhar R
    Replies:
    14
    Views:
    1,452
    =?iso-8859-1?Q?Fran=E7ois?= Pinard
    Feb 10, 2004
  2. Jean-Paul Calderone
    Replies:
    0
    Views:
    477
    Jean-Paul Calderone
    Mar 20, 2009
  3. Floris Bruynooghe
    Replies:
    1
    Views:
    472
    Floris Bruynooghe
    Mar 24, 2009
  4. Martin P. Hellwig
    Replies:
    1
    Views:
    387
    Martin P. Hellwig
    Mar 26, 2010
  5. Daemon Win32::Daemon;

    , Sep 7, 2006, in forum: Perl Misc
    Replies:
    0
    Views:
    274
Loading...

Share This Page