Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Oct 27th, 2005, 11:23 PM   #1
White-Hat`
Programmer
 
Join Date: Sep 2005
Location: Oopland
Posts: 36
Rep Power: 0 White-Hat` is on a distinguished road
Building a Daemon

I was wondering if anyone had any information or links for buildings daemons. Any information is appreciated
White-Hat` is offline   Reply With Quote
Old Oct 28th, 2005, 7:40 AM   #2
tempest
Programming Guru
 
tempest's Avatar
 
Join Date: Oct 2004
Posts: 1,041
Rep Power: 6 tempest is on a distinguished road
Send a message via ICQ to tempest Send a message via AIM to tempest Send a message via Yahoo to tempest
What would you like to know, how to start a program in deamon mode?

[php]
#include <stdio.h>
#include <stdlib.h>

int main(Int argc, char *argv[]) {
pid_t daemon = fork();

if(daemon < 0) {
fprintf(stderr, "Could not for process...\n");
exit(EXIT_FAILURE);
} else if(daemon == 0)
exit(EXIT_SUCCESS);


// Start program here...

return EXIT_SUCCESS;
}
[/php]
__________________

tempest is offline   Reply With Quote
Old Oct 28th, 2005, 9:06 AM   #3
Infinite Recursion
Programming Guru
 
Infinite Recursion's Avatar
 
Join Date: Jul 2004
Location: United States
Posts: 3,473
Rep Power: 8 Infinite Recursion is on a distinguished road
Send a message via MSN to Infinite Recursion Send a message via Yahoo to Infinite Recursion
If you want a client/server environment... I suggest reading this:
http://beej.us/guide/bgnet/
__________________
http://jasonpowers.net

"There are a thousand hacking at the branches of evil to one who is striking at the root."
Infinite Recursion is offline   Reply With Quote
Old Oct 28th, 2005, 12:01 PM   #4
Dameon
Troll
 
Dameon's Avatar
 
Join Date: Apr 2005
Location: Texas
Posts: 732
Rep Power: 4 Dameon is on a distinguished road
Tempest's example is only the first step to daemon-izing a program.
http://www.linuxprofilm.com/articles...mon-howto.html

If you want a Windows daemon, then I would suggest running it as a service. MSDN has a lot of resources on the subject.

Dameons are better anyway.
__________________
MD5(sig) = bcef75433db02e9ad9bf81d6f7c5c270
Dameon is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 4:44 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC