"Server" to Server Connection and Command Blacklist



Hi,

Since I posted the question, I would like to at least give the  
solution, too.

I played with the Maxima server mode, open3(), etc., and failed  
miserably, probably for lack of understanding of what select() really  
does. In the end, the best solution turned out to be Expect.pm -  
still screen-harvesting, but at least I don't have to start a new  
Maxima for each request.

The solution might have some more universal usefulness:

  http://www.lite.msu.edu/kortemeyer/lonmaxima

spawns off a number of child processes, each of which opens a Maxima  
and keeps it. You can then connect to the Maximas through a local  
socket,

  http://www.lite.msu.edu/kortemeyer/maximatestclient.pl

illustrates this.

The server program lonmaxima has a few LON-CAPAisms in it, for  
example "use LONCAPA::Configuration;" - if there's general interest,  
I can make a non-LON-CAPA version of this, or make a version that has  
a TCP socket rather than a file socket. Some error-handling would  
also be nice ...

Thanks all!

- Gerd.

On Mar 5, 2006, at 9:34 PM, Gerd Kortemeyer wrote:

> Hi,
>
> Sorry for a newbie question. I am trying to incorporate Maxima into  
> our LON-CAPA system (http://www.lon-capa.org/). I got it working,  
> but it is less than beautiful, since it more or less does screen  
> harvesting and needs to start a new Maxima process for every  
> evaluation. I'd much rather have a running Maxima process, and just  
> connect to it when I need something.
>
> Of course I found the "--server" command line option in the man- 
> pages, but reading this list, I found out that the Maxima server is  
> really a client and needs a running server. However, all I could  
> find was that usually xmaxima is this server.
>
> I imagine I need to write a small server program that runs on some  
> port, and then tell Maxima to connect to that port via the command  
> line open, and then I talk to my server via another port or socket  
> when I need something ... but then I am lost: I have no idea what  
> the protocol needs to be. Any hints or code snippets would help.
>
> Also, in Mediawiki's PHP script, I found a small "blacklist" of  
> commands to filter for from student input - the list is
>
> $maxima_blacklist = array("save", "load", "plot", "lisp", "includ",  
> "compil", "file", "batch", "stringout", "translat", "stout",  
> "stin", "block", "system");
> (by M. Arndt (February 2006))
>
> - a blacklist is nice, but is there a "safe" mode that disables  
> system and disk access in a command line or configuration that I  
> did not find?
>
> Thanks!
>
> - Gerd.
>