473,407 Members | 2,306 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,407 software developers and data experts.

Get reference to instance of daemon class

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
Jul 22 '05 #1
7 4219
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
Jul 22 '05 #2
raj
mi**@unfolded.com (Michael Ransburg) wrote in message news:<75**************************@posting.google. com>...
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
Jul 22 '05 #3
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

Jul 22 '05 #4
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
Jul 22 '05 #5
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
Jul 22 '05 #6
On Mon, 14 Jun 2004 21:41:27 GMT, JKop <NU**@NULL.NULL> 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_...er_software%29

You might want to do a little homework before slinging accusations.
Jul 22 '05 #7
> >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_...er_software%29

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
Jul 22 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stefan Seefeld | last post by:
hello, I'v run into a bug that I find hard to understand: In a python module of mine I import system modules ('sys', say) and then use them from within some functions. However, during...
9
by: ataraxia2500 | last post by:
I have a little exe that is used to launched a daemon and a gui: #include <stdlib.h> int main(void) {     (void)system("daemon.exe");     (void)system("gui.exe");     return 0; }
3
by: Adam | last post by:
We have a web site that uses .vb for the web pages and .cs for a class module. We are getting the error in .NET 2.0 and VS 2005 beta 2. It does work with .NET 1.1. When trying to access a page...
9
by: Dennis | last post by:
When a class (myownclass) inheirits another class, how can I get an object reference to the underlyng MyBase class instance from within myownclass. The base class has a method that I want to...
1
by: Stefan Neumann | last post by:
I have written a daemon which should run endlessly. The structure looks like this: - start-stop-daemon forks my python program then: if __name__=="__main__": try: main()
6
by: Grey Alien | last post by:
class A { public: A(const B& ref); private: static B& b ; }; How may b be initialized ?
5
by: Jeffrey Barish | last post by:
As per Stevens/Rago, "file and record locking provides a convenient mutual-exclusion mechanism". They note the convention of putting the lock file in /var/run in a file called <name>.pid, where...
0
by: Cameron Simpson | last post by:
On 12Nov2008 22:30, Jeffrey Barish <jeff_barish@earthlink.netwrote: | Cameron Simpson wrote: | Or, more simply, get root to make an empty pid file once and chown it to | the daemon user. Then the...
13
dmjpro
by: dmjpro | last post by:
class MainClass{ public static void main(String a){ //do something } } When i run this class file then JVM is the process having one main thread. Thread ends and process ends. I went...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.