LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 10-27-2004, 01:23 AM   #1
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Rep: Reputation: 30
Help in writing a C program as a service deamon


I want to write a deamon program that will create a random string and send it to its adjecent PC in a LAN?
First i want to know is that possible to send to neighbour PC? Is that require me to know its IP address?
I want to execute this program periodicaaly by 5 minutes and deamon will also store it in a file say /misc/text.txt file
And i want to make it standard service deamon on redhat Linux 9 PC.
how to do it?
 
Old 10-27-2004, 02:21 AM   #2
blackzone
Member
 
Registered: Jun 2004
Posts: 256

Rep: Reputation: 30
I'm not sure what you mean by adjacent PC

if you want to send it to every PC in the LAN you can send it through the broadcast IP

type "ifconfig" and it'll show the Bcast(braodcast IP)
 
Old 10-27-2004, 02:44 AM   #3
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
For your daemon to be able to send sth to its neighbours over the LAN, you first need to have a service ready to listening to it in each target hosts, preferably a service on UDP to allow broadcasts.
 
Old 10-27-2004, 03:11 AM   #4
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
how to write own service? is that mean my socket program then how to make it as a listening service?
 
Old 10-27-2004, 07:40 AM   #5
Hko
Senior Member
 
Registered: Aug 2002
Location: Groningen, The Netherlands
Distribution: Debian
Posts: 2,536

Rep: Reputation: 111Reputation: 111
Quote:
Originally posted by cranium2004
how to write own service? is that mean my socket program then how to make it as a listening service?
Call daemon(0,0) at the start of your program and open a listening socket.
 
Old 10-27-2004, 12:09 PM   #6
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
cranium2004, perhaps can you (re)use an already existing service on the target hosts.
What do you want them to do with your random string ?
 
Old 10-28-2004, 12:48 AM   #7
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
hello jilliagre,
its part of my project
 
Old 10-28-2004, 03:14 AM   #8
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
I've no doubt it's part of your project, but that doesn't answer my question ...
 
Old 10-28-2004, 03:52 AM   #9
cranium2004
Member
 
Registered: Feb 2004
Distribution: FC4,RHEL4
Posts: 223

Original Poster
Rep: Reputation: 30
heres the ans to ur question
i want to make 2 pcs routers and want those routers to exchange some random string for authentications to each others packet. this is short ans to ur question otherwise i have a full description of my project in big doc file.
 
Old 10-28-2004, 07:31 AM   #10
jlliagre
Moderator
 
Registered: Feb 2004
Location: Outside Paris
Distribution: Solaris 11.4, Oracle Linux, Mint, Debian/WSL
Posts: 9,789

Rep: Reputation: 492Reputation: 492Reputation: 492Reputation: 492Reputation: 492
Thanks for the explanation, and please no big .doc file !!!
An easy way to achieve that would be to send the strings with ftp, nfs or better scp, as I suppose security is a concern here.
 
  


Reply



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 Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
What is the last program you wrote (or are currently writing)? lowpro2k3 Programming 2 08-15-2005 01:14 AM
Writing Program Documentation Xyem Programming 1 07-30-2005 06:59 PM
Deamon Tools error - Service folder error joey52 Fedora 0 04-26-2005 02:13 PM
Need help writing a simple program justintime32 Mandriva 8 03-04-2005 08:12 PM
CD Writing program? Which is best? nro Linux - Software 14 09-01-2004 10:19 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 02:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration