> Message: 8 > Date: Fri, 22 Aug 2008 10:28:44 +0100 > From: "Alan Gauld" <[EMAIL PROTECTED]> > Subject: Re: [Tutor] pass argument into running program *outside* of > program > To: tutor@python.org > Message-ID: <[EMAIL PROTECTED]> > Content-Type: text/plain; format=flowed; charset="iso-8859-1"; > reply-type=response > > > "Alan Gauld" <[EMAIL PROTECTED]> wrote > > >> $ program.py addMe <username> <var2> > > > > create the server with a socket that listens for clients on a port > > create a client that talks to the socket via that port. > > > > Other options, cruder but arguably simpler, involve > sharing a database and using one table for input and another > for output. The server polls the input table and writes output to > the output table, the clients write requests into the input table > and read their results out from the output table.
In a much simpler situation, even a communicating from a plain file could be enough. In the daemon's program folder, there'll be two files: input and output. You write to input to instruct the server and read the response from output. This model is in respect to Unix's philosophy: "make program to handle text streams, because it's the universal interface". > This is surprisingly efficient and scaleable, I've had servers > handling several hundred simultaneous clients using this > scheme. Its very good where reliability and resiliance are > important because even if the machine goes dowen the clients > and servers can restart and pick up where they left off. > > Just a thought... > > Alan G. _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor