Re: inetd script in python?
From: Nick Craig-Wood (ncw_at_axis.demon.co.uk)
Date: 02/27/04
- Next message: Peter Otten: "Re: Problem with mixing doctest with gettext _()"
- Previous message: Pierre Rouleau: "Re: Problem with mixing doctest with gettext _()"
- In reply to: Jan: "inetd script in python?"
- Next in thread: William Park: "Re: inetd script in python?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 27 Feb 2004 18:30:03 GMT
Jan <jan.kesten@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)
sys.stdout.write(bfr)
You can then test the code on the command line by typing stuff to it
and seeing it print its output.
Beware buffering though!
-- Nick Craig-Wood ncw@axis.demon.co.uk
- Next message: Peter Otten: "Re: Problem with mixing doctest with gettext _()"
- Previous message: Pierre Rouleau: "Re: Problem with mixing doctest with gettext _()"
- In reply to: Jan: "inetd script in python?"
- Next in thread: William Park: "Re: inetd script in python?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|
|