syslogd (sorta)

Cecil H. Whitley cwhitley at earthlink.net
Wed Apr 30 23:03:59 EDT 2003


I am trying to write a syslogd server in python.  How can I "end" the main
thread and have a daemonic thread continue?  I am using windows nt and I
have tried

def syslogd():
# Lots of code initiating a udp socket on 514 and doing a
socket.recvfrom(maxpkt) and then kicking off another thread to process the
data.

main program

thread = threading.Thread(target=syslogd, name=syslogd, args=[], kwargs={})
thread.isDaemon(True)
thread.start()

That's it.  Main exits and activity stops.  If I add

junk = raw_input("Press return to exit")

Everything works just fine, up until I hit return of course.  So where
should I be looking in order to write a "clean" background process?

Thanks,

Cecil Whitley






More information about the Python-list mailing list