Suppose we create a link like this:
link = LinkCreate["mylink", LinkMode -> Listen]
How can we wait until this link gets connected to by another process, and time out if there's no incoming connection?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this communitySuppose we create a link like this:
link = LinkCreate["mylink", LinkMode -> Listen]
How can we wait until this link gets connected to by another process, and time out if there's no incoming connection?
LinkActivate
can be used for this. This Mathematica function is not documented, however the C version is.
From kernel 1, do
link = LinkCreate["mylink", LinkMode -> Listen]
LinkActivate[link] (* this will block and wait for an incoming connection *)
Now from kernel 2 (or another program, if using the C API), do
link = LinkConnect["mylink"]
LinkActivate[link]
(* will return immediately; at this point LinkActivate in kernel 1 also returns *)