Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

neo88

Linux Deamon

This topic is 5387 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Does anyone here know how to write a Linux Deamon? I want to write a deamon that ( obviosly ) runs in the background while my main programs are running. What I want the deamon to do ( geuss I should tell you, huh? ) is mask my ip address. Does anyone here know of some good articles to help my out? Websites? Thanks so much neo88

Share this post


Link to post
Share on other sites
Advertisement
I''m not quite sure what you mean by "mask my ip address", but it sounds like iptables could take care of the job for you. Just do a ''man iptables'' and look for the sections on MASQUERADE, SNAT, and DNAT.

Share this post


Link to post
Share on other sites
First, as Ranok pointed out, It is not clear what you want to do by "Mask my ip address". But since the question you ask is about daemon under Linux, I''ll try to give you some pointers on that.

First, you must realize that daemons are just regular programs that runs in the background, usually waiting for something to happen in order to do their job.

You''ll want to have your applications and daemons talking together at some point, and this is where you should investigate more. For that, you should check sockets, streams and other Inter Process Communication (IPC) technics.

Now, are you sure you need to split your program into a daemon and and apps ? If you only require your application to do more than one thing at the same time, you should look into using the "fork" keyword.

If you know how to write a program and make it run in the background, you should really be investigating IPCs. Google could help you, I have read a book called "Networking applications on UNIX system V Release 4". Not targetted at Linux and covering more than you require for what you need, but still got some good infos on that subject.

Hopes that helps at least a little.

Share this post


Link to post
Share on other sites
You can setup your own daemon without too much trouble (it''s just a program). Go here. The slides for week 5 are about daemons and there are instructions on how to install a daemon in the slides. You asked how to write a daemon, and if you know how to program, that should give you enough to be able to write some program and install it as a daemon. As for what you want the daemon to do, you''re on your own, as I have no clue how to write code for that.

Share this post


Link to post
Share on other sites
This is were the strangeness of my situation comes in. I cannot use iptables because Linux isn''t hooked up to the internet. What I want to have happen is: I want a program that runs as a deamon when I start my computer up, it needs to be able to mask my ip address ( ex. say my address is 34.896.201 and I want it to mask it to 506.890.78.234 as soon as I boot my CPU ) This deamon needs to be able to run under Linux and Windows 95, so I need some sort of universal deamon. And if I boot to Linux and switch to Windows I want the deamon to still run and vice versa.
Hope this helps you help me

neo88

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by neo88
This deamon needs to be able to run under Linux and Windows 95, so I need some sort of universal deamon. And if I boot to Linux and switch to Windows I want the deamon to still run and vice versa.
Hope this helps you help me

neo88


Yes: Not possible.

Share this post


Link to post
Share on other sites
You seem to lack an understanding of what an IP address it, or more specifically, how a computer gets an IP address.

Share this post


Link to post
Share on other sites
Chapter 13 of "Advanced Programming in the UNIX Environment" by the late W. Richard Stevens explains the process of daemonizing a process and discusses the intracacies of a daemon process.

Share this post


Link to post
Share on other sites
Hum, wouldn''t something like the OP is trying to do (have to) be acomplished by a router or the like? (or switch? I don''t understand switches though so just a blind guess)

I don''t really know all that much about network stuff though so I may be smoking something. (the 560 emails currently dling perhaps.)

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!