473,756 Members | 7,560 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 "getClassInstan ce('daemon')" to get a reference
to the instance of the daemon class
5) user calls daemon.getInfor mation();

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

Any assistance would be highly appreciated.

Thanks,
Michael
Jul 22 '05 #1
7 4241
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.c om (Michael Ransburg) wrote in message news:<75******* *************** ****@posting.go ogle.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 "getClassInstan ce('daemon')" to get a reference
to the instance of the daemon class
5) user calls daemon.getInfor mation();

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 "getClassInstan ce('daemon')" to get a reference
to the instance of the daemon class
5) user calls daemon.getInfor mation();

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 "Daemonnome aD".

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

Daemon* current_daemon = GetTheAddressOf ThatDaemonFromW herever();

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", "Annihilato r".
-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", "Annihilato r".
-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", "Annihilato r".
-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
1379
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 program termination I'm calling one such function and the module reference ('sys') is 'None' !
9
2337
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
4229
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 that needs the class module I get an error on web site: Object reference not set to an instance of an object Here is where the error is:
9
2104
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 utilize in myownclass but the method is private and can't be inheirited. I need to utilize that base class method. -- Dennis in Houston
1
1989
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
3247
by: Grey Alien | last post by:
class A { public: A(const B& ref); private: static B& b ; }; How may b be initialized ?
5
3280
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 <nameis the name of the daemon and content is the pid. Seems like a good suggestion as I see pid files from many other daemons there. However, /var/run is owned by root, so it is not possible to write in it without root permission. I could put...
0
1315
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 daemon can rewrite the file as needed. You need | to move to truncating the file instead of removing it on daemon shutdown, | but that is trivial. And no mucking with privileges, like starting the | daemon as root instead of directly as the daemon...
13
9300
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 through a link there i read about daemon thread.
0
9462
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9287
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10046
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9886
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9857
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8723
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5318
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3817
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2677
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.