Legacy Documentclose button

Important: The information in this document is obsolete and should not be used for new development.

Previous Book Contents Book Index Next

Inside Macintosh: Networking With Open Transport / Part 1 - Open Transport Essentials
Chapter 10 - Advanced Topics


Acknowledging Sends

By default, providers do not acknowledge sends. This means that when you send data, the provider copies the data into an internal buffer and then sends the data. Once the provider has copied the data into its own buffer, it no longer uses the buffer you have allocated for the data. As soon as the function completes, you can change the contents of your buffer--even if the provider has not yet sent the data it copied.

If you use the OTAckSends function to specify that you want the endpoint provider to acknowledge sends and you call a function that sends data, the endpoint provider does not copy data from your buffer before sending it. Instead it reads data directly from your buffer while sending. For this reason, you must not change the contents of your buffer until the endpoint provider is no longer using it. The advantage of acknowledging sends is that it improves performance at the cost of some added complexity in your code.

Sometimes, due to flow control, a send operation can be delayed. The provider lets you know that it has finished using the buffer by calling your notifier function and passing T_MEMORYRELEASED for the code parameter, a pointer to the buffer that was sent in the cookie parameter, and the size of the buffer in the result parameter.

WARNING
If you want Open Transport to acknowledge sends, you must make sure that there are no outstanding sends when you close Open Transport; otherwise, you crash.
Because of the complexity of handling flow control, Open Transport performance suffers when the acknowledge sends option is used with noncontiguous data, such as when you pass an OTData structure to the OTSnd function. Therefore, it is best to avoid this option with non-contiguous data, especially if the last element is a large element.

Only endpoint provider functions are affected by your calling the OTAckSends and OTDontAckSends functions.

IMPORTANT
If the endpoint acknowledges sends and there are outstanding buffers still in use, you must flush the buffers before closing the endpoint provider. To flush the stream, call the function OTIOCtl as follows:

OTIOCtl (MyEptref, FLUSHRW, 0);

Then, wait until you receive all of the T_MEMORYRELEASED events.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998