client server socket interaction (inetd)
jtim.arnold at gmail.com
Thu Feb 17 22:02:08 CET 2011
On Feb 17, 2:41 pm, Martin Gregorie <mar... at address-in-sig.invalid>
> On Thu, 17 Feb 2011 08:14:36 -0800, Tim wrote:
> > Hi, I have an inetd service on freebsd that calls a program (daemon.py)
> > with which I want the remote user to communicate. I can call daemon.py
> > from the command line on the host machine and it works fine.
> > What I don't understand is how to make my remote client script actually
> > communicate. If I'm understanding correctly, the code below just takes a
> > message and sends it to inetd and writes the stdout from the process to
> > the client.
> > How can I modify the code to send a response back?
> martin@ | Martin Gregorie
> gregorie. | Essex, UK
> org |
Thanks Martin, you're right:
> Each time you run the client it:
> - connects to the server
> - sends a request
> - reads the response(s)
> - closes the socket and exits.
that is exactly what it's doing. But. The server may encounter a
problem during the process and ask the user for more information like
'abort/retry' or something like that.
What my code does *not* do is allow the user to respond to such a mid-
process question (so the server can take in that information and
proceed with its process). The server can ask, but there's no
mechanism for the user to respond to a question.
> Without seeing the code for the server and the corresponding inetd
> configuration line its not possible to say more.
I'm not trying to be opaque, but the reason I left out the code for
the server (daemon.py) is that it works as expected when exec'd from
the command line. That is, the process begins, asks a question, gets
an answer and continues.
The inetd configuration is:
myservice stream tcp nowait root /local/daemon.py daemon.py
More information about the Python-list