Hi All,<div><br></div><div>I have found out what caused my problems.</div><div><br></div><div> When starting Maxima with -s one must read the output from</div><div> input port return by (tcp-accept listener) in the snippet.</div>
<div> But one must write to the output port returned by</div><div> (process (format "... maxima.sh -s ~a" PORT))<br> in order to send commands to Maxima.</div><div><br></div><div>It seems somewhat fishy to me, so maybe I have omitted a Maxima flag.</div>
<div>I'll ask at the Maxima mailing list.</div><div><br></div><div>Neil: Thanks for the suggestion of using sync. It works really well.</div><div><br></div><div>/Jens Axel</div><div><br></div><div><br><div class="gmail_quote">
2012/3/8 Jens Axel Søgaard <span dir="ltr"><<a href="mailto:jensaxel@soegaard.net">jensaxel@soegaard.net</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="gmail_quote">2012/3/8 Neil Van Dyke <span dir="ltr"><<a href="mailto:neil@neilvandyke.org" target="_blank">neil@neilvandyke.org</a>></span></div><div class="gmail_quote"><br></div><div class="gmail_quote">
<div>Thanks for taking the time to look at the problem.</div><div class="im">
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">It sounds like Maxima and your Racket program are both trying to be the TCP listener. Maybe "tcp-connect" instead of "tcp-listen"?<br>
</blockquote><div><br></div></div><div>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.</div><div>This comment is from the Maxima code:</div>
<div><br></div><div><div>;; Connect Maxima to a socket which has been opened by</div><div>;; some third party, typically a GUI program which supplies</div><div>;; input to Maxima.</div><div>;; Note that this code DOES NOT create a Maxima server:</div>
<div>;; Maxima is the client!</div></div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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.<br>
</blockquote><div><br></div></div><div>I'll look into this. I did run into blocking problems in earlier versions of my snippet. </div><div class="im"><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
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).<br>
</blockquote><div> </div></div><div>Ok.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>/Jens Axel</div><div><br></div></font></span></div></blockquote></div>
</div>