Next: , Previous: , Up: Misc Facilities   [Contents][Index]

6.2 Communication

The (dmd comm) module provides primitives that allow clients such as deco to connect to dmd and send it commands to control or change its behavior (see actions of services).

Currently, clients may only send commands, represented by the <dmd-command> type. Each command specifies a service it applies to, an action name, a list of strings to be used as arguments, and a working directory. Commands are instantiated with dmd-command:

procedure: dmd-command action service [#:arguments '()] [#:directory (getcwd)]

Return a new command (a <dmd-command>) object for action on service.

Commands may then be written to or read from a communication channel with the following procedures:

procedure: write-command command port

Write command to port.

procedure: read-command port

Receive a command from port and return it.

In practice, communication with dmd takes place over a Unix-domain socket, as discussed earlier (see Invoking dmd). Clients may open a connection with the procedure below.

procedure: open-connection [file]

Open a connection to the daemon, using the Unix-domain socket at file, and return the socket.

When file is omitted, the default socket is used.

The daemon writes output to be logged or passed to the currently-connected client using local-output:

procedure: local-output format-string . args

This procedure should be used for all output operations in dmd. It outputs the args according to the format-string, then inserts a newline. It writes to whatever is the main output target of dmd, which might be multiple at the same time in future versions.

Next: , Previous: , Up: Misc Facilities   [Contents][Index]