inetd script in python?
donn at u.washington.edu
Mon Mar 1 20:30:01 CET 2004
In article <slrnc3v1ka.mk5.ncw at irishsea.home.craig-wood.com>,
Nick Craig-Wood <ncw at axis.demon.co.uk> wrote:
> Jan <jan.kesten at web.de> wrote:
> > So far I read about that I could use stdin and stdout for
> > communication since inetd handles the socket. And I read that I
> > could use socket.fromfd to get a socket object to work with. But
> > both do not work, I tried to send just a greeting back to the
> > client or getting some text - nothing.
> You should find something simple like this works - inetd is supposed
> to make writing internet daemons easy!
> import sys
> while 1:
> bfr = sys.stdin.read(1024)
> You can then test the code on the command line by typing stuff to it
> and seeing it print its output.
> Beware buffering though!
Indeed, to the point where the code you propose would not
work when you test it the way you propose.
Donn Cave, donn at u.washington.edu
More information about the Python-list