Basics

## 10.2 Basics

The remote interface is established by attaching the remote and ECLiPSe processes. The attachment establishes two socket connections between the two processes:

Control
  This connection is used to control the remote interface. Messages (in EXDR format) are sent in both directions according to the remote protocol to co-ordinate the two processes.
Rpc
  This is used to send ec_rpc goals from the remote process to ECLiPSe and return the results. The goal is sent in EXDR format.

More than one remote attachment can be established in an ECLiPSe process. Each attachment is independent, and is a remote peer, identified by its control connection. Each remote attachment has two sides: the ECLiPSe side, and the remote side.

At any one time, either the ECLiPSe or the remote side has control. When a side has control, it is able to send messages to the other side via the control connection. The side that does not have control waits for messages to arrive on the control connection. On the ECLiPSe side, execution is suspended while it does not have control. In general, once a control message is sent, the control is passed to the other side, and the side that sent the message waits for a reply message from the other side.

The ec_rpc mechanism is designed to be the main way for the remote side to interact with the ECLiPSe side. The remote side can send an ECLiPSe goal, in EXDR format to be executed by the ECLiPSe side. This can only be done while the remote side has control, and when the goal is issued, a message is sent via the control connection to the ECLiPSe side, and control is passed to the ECLiPSe side. Control is passed back to the remote side when ECLiPSe completes the execution of the goal.

After the attachment, extra I/O connections can be established between the two sides. This allows data to be transferred from one side to the other. These connections (referred to as peer queues) can be of two types:

synchronous
  These queues are synchronised by the control connection. Control messages are exchanged between the two sides to ensure that they are both are synchronised for the data transfer: one side consumes the data that is sent from the other. This ensures that no blocking occurs with the I/O operations across the sockets.
asynchronous
  These queues can perform I/O operations that are not co-ordinated by the control connection. Either side can write to or read from the queue without transferring control. In fact, if the remote language is multi-threaded, it can perform asynchronous I/O while ECLiPSe side has control. Note that asynchronous I/O operations may block on the ECLiPSe side.