This is documentation for Mathematica 8, which was
based on an earlier version of the Wolfram Language.
View current documentation (Version 11.2)

LinkConnect

LinkConnect
connects to a MathLink link created by another program.
  • The option LinkProtocol allows other data transport protocols to be specified.
  • You can use LinkConnect with LinkCreate to set up peer-to-peer communication between two Mathematica processes.
  • LinkConnect can be used to connect to a link created by calling LinkCreate in another Mathematica process.
  • LinkConnect can be used to connect to an external program that has created a MathLink link by calling the appropriate MathLink library functions.
  • External programs built from MathLink templates using and can typically create MathLink links whenever they are given command-line arguments.
  • LinkConnect internally calls a function analogous to the function in the MathLink library.
  • Even though no program may yet be connected to the other end of the MathLink link, the function LinkConnect will return immediately and will not block.
Start a subsidiary Mathematica kernel process and set it to listen on port :
Connect to :
Read the first packets:
Get the $ProcessID of :
$ProcessID of the current Mathematica session:
Close and the link:
Start a subsidiary Mathematica kernel process and set it to listen on port :
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Connect to :
In[4]:=
Click for copyable input
Out[4]=
Read the first packets:
In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=
Get the $ProcessID of :
In[7]:=
Click for copyable input
In[8]:=
Click for copyable input
Out[8]=
$ProcessID of the current Mathematica session:
In[9]:=
Click for copyable input
Out[9]=
Close and the link:
In[10]:=
Click for copyable input
New in 3