Bewerken

Delen via


Add bidirectional communication

The spooler provides support for bidirectional ("BiDi") communication between an application or driver and a printer. This support enables the application or driver to send one or more requests to the printer, and the printer to respond to these requests.

diagram illustrating bidirectional support architecture.

Bidirectional communication requirements

Before an application or driver can use bidi communication, it must implement bidirectional communication interfaces: either the IBidiSpl COM interface or the IbidiSpl2 COM interface, together with at least one of the IBidiRequest and IBidiRequestContainer COM interfaces. In addition, one or both of the following must be true:

To send a single request to the printer, an application or printer driver must first compose the request, and then call the IBidiSpl::SendRecv method. To send multiple requests, the application or driver composes a list of requests, and then calls the IBidiSpl::MultiSendRecv method.

After receiving the request, the client-side portion of the spooler (Winspool.drv) passes it on to the server-side spooler (spoolsv.exe). The server-side spooler can be on the local computer, or on a remote network print server. When the server-side spooler receives the request, it parses the data in the request, and fills in the members of a BIDI_REQUEST_CONTAINER structure.

The server-side spooler then calls SendRecvBidiData or SendRecvBidiDataFromPort. When either function returns, its ppResData parameter points to a memory location that contains the address of a filled-in BIDI_RESPONSE_CONTAINER structure that contains the printer's response. The server-side spooler converts the data in this structure to a form suitable for use by the application or driver, and passes it back to the client-side spooler, and finally back to the originator of the request.