Error using Sockets with Maxima



Robert Dodier wrote:
> On 2/17/12, Brian Chacko <brianchacko at yahoo.com> wrote:
>
>> I wanted my API to communicate with maxima using sockets the same way
>> WxMaxima is being used. Using this method,  I created a local server
>> application and try to connect maxima to the server using the command
>>
>> [Path to maxima.bat]/maxima.bat -s 7755
>>
>> I get the following error...
>>
>> [Path to Maxima]\bin>maxima.bat -s 7755
>> Connecting Maxima to server on port 7755
>> Maxima encountered a Lisp error:
>>
>>  Error in LISP:LAMBDA-CLOSURE [or a callee]: Could not connect
>
> Brian, maxima -s doesn't create a Maxima server (i.e. listening on
> the specified port). Instead it creates a client, which attempts to
> connect to a server (such as wxMaxima) on the port.
>
> Take a look at pMaxima, which is a Maxima server implemented
> in Perl. There's a little bit about it in this message:
> http://permalink.gmane.org/gmane.comp.mathematics.maxima.general/37185
>
> HTH
>
> Robert Dodier


Indeed maxima -s doesn't create a listening socket so needs someone else to do
that.
What pMaxima does is that the perl program creates a listening socket and
listens on it, and at the same time forks a child which fires up a maxima -s
program connected to the same port.

At lest for me, maxima -s does *not* work for whatever reason.
If i do in one window
Last login: Fri Feb 17 18:21:42 on ttys000
lilas% nc -l 8888
pid=13746
(%i1) 1+1;

that is i create a listening socket with nc and in another window i create the
maxima -s
Last login: Fri Feb 17 01:18:08 on ttys000
lilas% maxima -s 8888
Connecting Maxima to server on port 8888

then i get the prompt (%i1) and i can type 1+1; but then everything hangs and
i have no further output. Maybe this is nor exactly the intended use.

If insted of using maxima -s i do the following
lilas% maxima -r ":lisp (setup-client 8888)"
(%i1)
Then in the other window i have a maxima server which is not hanged:
lilas% nc -l 8888
pid=13770
(%i1) 1+1;

(%o1)                                  2
(%i2)

What is the exact difference with maxima -s i don't know, but for me one works
and not the other.


-- 
Michel Talon