[Mono-list] Writing daemons in C#
Joe Mozelesky
jmozelesky@netcarrier.com
Mon, 18 Nov 2002 15:09:39 -0500
What if you want to write a service/daemon that is portable to both
Windows and Linux with no code changes. If it compiles to the .NET
Framework as a "Service" shouldn't it then work with no changes on
Linux? Any of the platform-specific bits should be wrapped by the
Framework implementation.
Joe
-----Original Message-----
From: Erik Bågfors [mailto:erik@bagfors.nu]
Sent: Monday, November 18, 2002 3:02 PM
To: Joe Mozelesky
Cc: Mono List
Subject: RE: [Mono-list] Writing daemons in C#
How do you define daemon? For me a daemon is just a piece of software
that runs in the background and handles some kind of request!
Normally in the unix-world you simply fork and keep running (after som
setsid and stuff like that). So you can either pinvoke that stuff or
simple start it in the background. I see no reason to do all the above
if you want a unix-daemon.
/Erik
On Mon, 2002-11-18 at 20:23, Joe Mozelesky wrote:
> >From my trusty Wrox Professional C# book, Chapter 24 is called
“Windows
> Services.” “In the .NET Framework, we can find service classes in the
> System.ServiceProcess namespace that implement the three parts of a
> service:
>
> • We inherit from the ServiceBase class to implement a service.
> • The ServiceController class is used to implement a service control
> program.
> • The ServiceProcessInstaller and ServiceInstaller classes are, as the
> names suggest, classes to install and configure the service programs.”
>
> A service on Windows is the equivalent of a daemon on Linux. Note
that
> this is different from COM+ services .
>
> So for instance if you wanted to write an FTP daemon that listens on a
> port you might use System.ServiceProcess along with
System.Net.Sockets.
>
> However, when I browse the Class Status on the Mono homepage, I do not
> see the System.ServiceProcess namespace anywhere, so I don't know if
the
> maintainers have any plan to implement this in Mono or not. However
> when I ran a search of the mailing list archives I came up with these
> two links:
>
>
http://lists.ximian.com/archives/public/mono-patches/2002-March/001515.h
> tml
>
http://lists.ximian.com/archives/public/mono-patches/2002-June/004426.ht
> ml
>
> Where System.ServiceProcess is referred to, so perhaps it is planned
to
> be implemented.
>
> So I would suppose that means that you won't be able to write daemons
> with C# and Mono until sometime in the future when the namespace has
> been implemented.
--
Erik Bågfors | erik@bagfors.nu
Supporter of free software | GSM +46 733 279 273
fingerprint: 6666 A85B 95D3 D26B 296B 6C60 4F32 2C0B 693D 6E32