ACSE/Presentation and ROSE Interface Programmer's Guide

58 Chapter 4
Programming Guide
5. Managing Multiple Connections
5. Managing Multiple Connections
Before writing an application with multiple connections, you may need to
consider the following items:
Execution mode
Connection retry
Resource constraints
Execution Mode
For using multiple connections, asynchronous mode is recommended.
Using multiple connections introduces factors that cannot be controlled
such as: when a task will complete, how long a task will take, or whether
or not tasks will complete sequentially. Factors affecting task completion
include network traffic and the load on the system. Using synchronous
mode can introduce deadlock situations. For example, consider the
following scenario using first synchronous then asynchronous
processing:
Two processes, an initiator and responder are each managing two
communication endpoints. The initiator side of the communication
endpoints are labeled A and B. The responder side of the communication
endpoints are labeled C and D (see Figure 4-1).
Communication endpoint A initiates a connection and transfers two data
packets over the connection to C. Two data packets are transferred over
the connection from C to A. Then endpoint A initiates a connect release
after it receives the two data packets.
Now, since the completion time of each task is not guaranteed (as
previously described), the following situation could occur:
The initiator process is servicing endpoint B which has just sent out a
connection request (A_ASSOC_REQ) and is waiting for confirmation
(A_ASSOC_CNF).
Endpoint A received the first data packet and is waiting for its turn to
receive the last data packet already on the queue before it sends out a
release request (A_RELEASE_REQ). At the same time, the responder
process is servicing endpoint C which has already sent its two data