LinkPatterns[link] gives a list of the patterns defined when the specified link was set up.
You can remove these definitions and terminate the execution of the external program by calling Uninstall[link].
Install[LinkConnect["port"]] will install an external program that has created a link on the specified port. You can use this to call external programs that have been started in a debugger or on a remote computer system.
If you call Install["command"] multiple times with the same command, the later calls will overwrite definitions set up by earlier ones, unless the definitions depend on the values of global variables which have changed.
Install sets up definitions which send CallPacket objects to the external program whenever functions in it are called, and waits for results to be returned in ReturnPacket objects.
The external program can send EvaluatePacket objects back to Mathematica to request evaluations while the program is running.