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 5 - Programming With Open Transport


Improving Performance

The following suggestions for improving performance were drawn up with servers in mind; however, if your application needs to handle multiple connection requests, you might find the section "Streamlining Endpoint Creation" useful. For additional information on handling throughput to improve performance, see the chapter "Advanced Topics".

Streamlining Endpoint Creation

The time required to create and open an endpoint can delay connection set-up time. This can adversely affect servers, especially HTTP servers, since they must manage high connection turnover rates. To handle this problem, follow these guidelines:

Handling Dead Clients

A properly designed server should be prepared to handle what happens when a remote client unexpectedly disappears. This problem is further aggravated when the link has been flow-controlled. For example:

  1. You are transmitting a large amount of data to a client.

  2. Your transport provider enters a flow-control state.

  3. The client crashes or becomes unreachable.

  4. After a timeout, your server decides to force a disconnect from that client and issues a disconnect request.

  5. However the T_DISCONNECT event is subject to flow control, which causes your link to hang.

You can solve this problem by flushing the stream before requesting the disconnection. The best way to do this is to send the I_FLUSH command to the stream head using the OTIoctl function. For example:

#include <stropts.h>

/* check to see if you are already disconnected */

error = OTIoctl(ep, I_FLUSH, (void*) FLUSHRW);
if error OTUnbind(ep)
  .....

MyNotifyProc (... void* the Param) {
   case kStreamIoctlEvent        /* flush is complete */
      (void) OTSndDisconnect (ep, NULL);/* safe to disconnect */
      break;
}
This will result in your notifier receiving all T_MEMORYRELEASED events for any outstanding send calls that acknowledge sends. You should then attempt to send the disconnection request.

Shutting Down Servers

To shut down an Open Transport network server properly, you need to:


Subtopics
Streamlining Endpoint Creation
Handling Dead Clients
Shutting Down Servers

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 JAN 1998