The communication through ports

The communication of the driver with the SpecialHost program is taking place through a message port. As soon as SpecialHost is started, it opens a port with the name ``special_dvi''. The program waits by this port for messages of the driver.

When a driver encounters a
special-string in the DVI-file, it first tests, whether the port of the SpecialHost program exists. If not, it ignores the string. In case it does, the driver creates a port with the name ``special_reply'' and installs it as a reply port.

Through the port ``special_dvi'' it sends the SpecialHost program a message, in which the current resolution of the printer (or that of the screen) as well as the
special-string are contained.

SpecialHost evaluates this message and appends the special_map structure to it. This contains the size of the picture, the offset and also the name of the bitmap file or a pointer to the bitmap. This message sends it per ``ReplyMsg'' back to the driver.

As soon as the driver has evaluated all the information of the ``special_map'', it sends the SpecialHost program another message, so that it knows, that the storage space of the ``special_map'' can be freed again. This message is acknowledged by SpecialHost immediately.

After that the driver erases its Reply-Port.

While this communication is happening – between the sending of the first message by the driver, and the return of the second message by the SpecialHost program – the dialogue between the two partners must not be interrupted. As soon as one of the two terminates the communication, a deadlock is created. The other program waits until the next reset. As no timeout is implemented, in this case only a reboot helps. If you change the SpecialHost program, then you should take notice, that during the communication the program cannot be broken. Also in case of an error, the communication must be finished.