[tkined] Re: Daemon Program

From: Doug Hughes (Doug.Hughes@eng.auburn.edu)
Date: Mon Oct 09 2000 - 21:55:20 MET DST

On Sat, 7 Oct 2000, Jeffrey Baker wrote:

> Hello,
> Could tou please give me some guidance. I want to write a
> Tcl or c program that I can install as a daemon in "/etc/services" on port
> 1122.
> It should allow a user to connect, without authentication and
> "tail" a file to them every minute( eg sleep 60) ,as long as they are
> connected.
> Any ideas how to do it. Or can you direct me to guide on the
> Internet that teaches a beginner simple daemon programming.
> Thanks
> Jeffrey Baker

I don't know about guides on the Internet, you could just use a good
search engine like google.com and put in 'writing daemon code' or
something like that.
Here's an example of a simple daemon in Tcl that does what you want.


set FILE /var/adm/messages

proc sendfile {chan} {
        global FILE

        puts $chan [exec tail $FILE]
        flush $chan

        after 60000 sendfile $chan

proc sockh {chan addr port} {
        sendfile $chan


socket -server sockh 1122
vwait n

!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.

This archive was generated by hypermail 2b29 : Mon Jan 08 2001 - 15:27:54 MET