[racket] Using Maxima fra Racket

From: Jens Axel Søgaard (jensaxel at soegaard.net)
Date: Fri Mar 9 03:18:53 EST 2012

Hi All,

I have found out what caused my problems.

   When starting Maxima with -s one must read the output from
   input port return by (tcp-accept listener) in the snippet.
   But one must write to the output port returned by
   (process (format "... maxima.sh -s ~a" PORT))
   in order to send commands to Maxima.

It seems somewhat fishy to me, so maybe I have omitted a Maxima flag.
I'll ask at the Maxima mailing list.

Neil: Thanks for the suggestion of using sync. It works really well.

/Jens Axel


2012/3/8 Jens Axel Søgaard <jensaxel at soegaard.net>

> 2012/3/8 Neil Van Dyke <neil at neilvandyke.org>
>
> Thanks for taking the time to look at the problem.
>
> It sounds like Maxima and your Racket program are both trying to be the
>> TCP listener.  Maybe "tcp-connect" instead of "tcp-listen"?
>>
>
> I am fairly sure that part is correct. I do receive the welcome message
> from Maxima. And I took a peek in the Maxima code to see what -s does.
> This comment is from the Maxima code:
>
> ;; Connect Maxima to a socket which has been opened by
> ;; some third party, typically a GUI program which supplies
> ;; input to Maxima.
> ;; Note that this code DOES NOT create a Maxima server:
> ;; Maxima is the client!
>
>
>> Once that's working, for robustness, you might want to manage some TCP
>> I/O buffers yourself, and use "sync" (or "sync/timeout" or similar) on the
>> ports.  Using the buffers also makes it easier to look for some markers in
>> the protocol without blocking.
>>
>
> I'll look into this. I did run into blocking problems in earlier versions
> of my snippet.
>
>
>> P.S., I know you used that "process" temporarily here, but for the
>> benefit of people who see this later, they should try to use "process*"
>> instead, and monitor the status of the ports and the process (possibly in
>> the same "sync" as the TCP ports).
>>
>
> Ok.
>
> /Jens Axel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.racket-lang.org/users/archive/attachments/20120309/6286f630/attachment-0001.html>

Posted on the users mailing list.