Running Programs on Remote Computers

MathLink allows you to call an external program from within Mathematica even when that program is running on a remote computer. Typically, you need to start the program directly from the operating system on the remote computer. But then you can connect to it using commands within your Mathematica session.

Operating system on toad.wolfram.com

This starts the program and tells it to create a new link.
fprog -linkcreate -linkprotocol TCPIP
The program responds with the specification of the link it has created.
Link created on: 2976@toad.wolfram.com,2977@toad.wolfram.com 

Mathematica session on frog.wolfram.com

This connects to the link that has been created.
In[1]:=
Click for copyable input
Out[1]=
This now executes code in the external program on .
In[2]:=
Click for copyable input
Out[2]=

External programs that are created using or always contain the code that is needed to set up MathLink connections. If you start such programs directly from your operating system, they will prompt you to specify what kind of connection you want. Alternatively, if your operating system supports it, you can also give this information as a command-line argument to the external program.

prog-linkcreate -linkprotocol TCPIPoperating system command to run a program and have it create a link
Install[LinkConnect["port1@host,port2@host",LinkProtocol->"TCPIP"]]Mathematica command to connect to the external program

Running an external program on a remote computer.

New to Mathematica? Find your learning path »
Have a question? Ask support »