# Using document queues

NaturalFax functions operate on document queues, not on individual files. Use a document queue for all fax operations, including transmitting or receiving single documents.

A document queue contains a list of one or more document files in TIFF-F or TIFF-S format. NaturalFax has two kinds of document queues: send queues and receive queues. Use send queues to transmit documents, and receive queues to receive documents.

Each document queue is linked to a specific context. Each context may have multiple send and receive queues.

## Building a document queue

To create a new document queue, call nfxCreateQueue. This function returns a queue handle that uniquely identifies the queue. When you call nfxCreateQueue, specify the type of queue to be created (send or receive).

After creating a send queue, use nfxEnqueueDoc to add document files to the queue. Only files that already exist can be added to a send queue. The same file can be placed in multiple send queues simultaneously.

NaturalFax sends each enqueued file as a separate message (refer to the Group 3 fax technology section for information about T.30 messages). For example, if you enqueue a three page file and a five page file, the remote fax machine receives a three page message followed by a five page message. NaturalFax will not send both files in a single eight page message.

NaturalFax does not modify or delete any document files when sending. Only received document files can be modified. Each document to be received must have an entry in the receive queue. When adding files using nfxEnqueueDoc, the receive name can not be NULL, and the file must not already exist.

NaturalFax receives each multiple page message into a single file. The next document in the queue is used only if the remote fax machine sends a new message. This method of file management is specific to computer-based fax applications.