[Mono-dev] Writing a cross platform daemon in C#

Paul paul at all-the-johnsons.co.uk
Fri Jan 8 13:47:28 EST 2010


Hi,

It's a new year so I'm going to address a long standing problem - my
son.

Okay, he's not the problem, his computer use is. What I want to do is
write a daemon which can be used on his XP box at his and my linux boxes
here which will limit the amount of network time he is allowed per day
(and which I or his mother can change depending on need - at his mums,
he is kicked off after an hour completely, but this needs to be changed
as he needs to be on the machine for more than an hour for his homework
assignments).

The idea is this. Monitor TCP:80 packet traffic to his IP address. When
traffic is seen, the timer starts and racks up the total time. After a
pre-determined time, his network connection is closed until the start of
the next day when it is reset.

I can find his internal IP address simply (/sbin/ifconfig for the linux
box and ipconfig /all for Vista or XP and grep through it - not sure if
there is a simpler way in C# to do this).

The problem is monitoring port 80 in a daemon. The rest isn't that hard,
set up the daemon to register the current day and reset if it's a new
day. I also don't know how daemons are handled under Vista (they're
called services in Win32 land IIRC).

Does anyone have any examples of (or can point me to easy to understand
examples of) daemons in C# and port monitoring in C#?

Thanks

TTFN

Paul
-- 
Sie können mich aufreizen und wirklich heiß machen!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part
Url : http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100108/a18c13ee/attachment-0001.bin 


More information about the Mono-devel-list mailing list