>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User

# Communications Protocol

Opening the conversation:
The client always initiates the conversation by sending a message to the server. The server must be ready to respond. How the server does this depends on the application.

For J to act as a server, you must have first loaded J and set the service name, either from the command line or using the ddename command. You also need event handlers for the events you want to respond to.

Client commands:
The client can send four types of messages:

- a ddepoke message sends data to the server. The server does not respond. How the server treats this data depends on the application. If the server is a spreadsheet, the data may be written to the current worksheet; if the server is J, it may be treated as a sentence to be executed.
- a ddeex message sends a command to the server. The server does not respond. How the server treats this depends on the application, but it would typically be used to invoke a macro command in the server. A J server does not have to recognise this message, since a ddepoke message can be used instead.
- a ddereq message sends a request for a data item to the server. The server responds with the data item.
- a ddestart message sets up an advise loop, asking the server to advise the client whenever a specific data item has changed. The ddestop message terminates the advise loop. Once an advise loop has been initiated, the client must be prepared to accept messages from the server at any time.

  Closing the conversation:
  A conversation is closed whenever either application terminates. A client can also close the conversation by issuing a ddedis command (received by Windows, but not sent to the server).

>> << Ndx Usr Pri Phr Dic Rel Voc !: wd Help User