MathChat A MathLink (tm) Based Chat Program by John Brewer MathChat is a simple chat program written on top of MathLink. My goals in writing it were: 1. To demonstrate that neither side of a MathLink connection need be a Mathematica(R) kernal. 2. To show how, by using the MathLink libraries, one can write a fairly sophisticated networking application in a small amount of code.* To use MathChat, you will need two copies running on two different Macs running System 7. The listening Mac must have "Program Linking" turned on (from the Sharing Setup control panel).** On the listening Mac, press "L" at the prompt. This will cause MathChat to appear on the network as a linkable application. Once the listening Mac is in listen mode, the user at the connecting Mac should press "C" at the prompt. This will produce a standard PPC Browser dialog. Choose the zone and machine you wish to connect to, and choose the program "MathChat". Once you have done this, a connected message will appear, anything you type on either machine will be echoed to the other machine, as soon as you press return. The source code to MathChat is pretty straightforward. The only tricky bit is in DoChat(), which uses a state machine to poll the keyboard for characters while similtaneously polling MathLink for incoming lines of text. Since this code uses only MathLink and ANSI standard I/O, it should be readily portable to other platforms. Anyone interrested in porting MathChat should feel free to contact me at the e-mail address above, as should anyone with any bug reports or feature requests. -------- * The original MathChat.c fit on one page when printed by BBEdit Lite with a 50% reduction in Page Setup, and two column mode in BBEdit's printing options dialog. I use these settings for all my listings, as it produces compact but legible hard copy. The final version of MathChat went over a page by precisely the size of the MyYieldFunction routine. I decided to keep it in, though. :-) ** This is because MathChat tells MathLink to use the Macintosh PPC toolkit as the underlying connection link, which provides a friendly "browser" that lets the user choose which machine to connect to. MathChat can be recompiled to use TCP as its underlying link protocol (by changing the arguments to MLOpen() in routine OpenLink()), but this requires a hard coded IP address and socket number. MathLink and Mathematica are registered trademarks of Wolfram Research, Inc. Other products are trademarks of their manufacturers.